/**
 * Copyright (c) 2026 Huawei Technologies Co., Ltd.
 * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
 * CANN Open Software License Agreement Version 2.0 (the "License").
 * Please refer to the License for details. You may not use this file except in compliance with the License.
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
 * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
 * See LICENSE in the root of the software repository for the full text of the License.
 */

/*!
 * \file aclsparse_logger_manager.cpp
 * \brief ops-sparse log配置管理模块
 */

#include "aclsparse_logger_manager.h"
#include "dlog_pub.h"

// OP_MODULE_ID is defined by CANN HAL (common_pkg.h), but that header is not
// in the standard op_common include path. Define a local fallback so that
// dlog_setlevel() compiles without the HAL dependency.
#ifndef OP_MODULE_ID
#define OP_MODULE_ID 63
#endif

namespace AclSparse {

aclsparseStatus_t aclsparseLoggerSetLevel(aclsparseLogLevel_t logLevel)
{
    switch (logLevel) {
        case aclsparseLogLevel_t::LOG_LEVEL_INFO:
            dlog_setlevel(OP_MODULE_ID, DLOG_INFO, 1);
            break;
        case aclsparseLogLevel_t::LOG_LEVEL_ERROR:
            dlog_setlevel(OP_MODULE_ID, DLOG_ERROR, 1);
            break;
        case aclsparseLogLevel_t::LOG_LEVEL_DEBUG:
            dlog_setlevel(OP_MODULE_ID, DLOG_DEBUG, 1);
            break;
        default:
            dlog_setlevel(OP_MODULE_ID, DLOG_INFO, 1);
            break;
    }
    return aclsparseStatus_t::ACL_SPARSE_STATUS_SUCCESS;
}


}