* Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
* MindIE is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
* 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 FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
*/
#ifndef MINDIE_LOG_DEF_H
#define MINDIE_LOG_DEF_H
#include <sstream>
#include <string>
namespace mindie_llm {
const std::string MINDIE_SERVER = "server";
const std::string SUBMODLE_NAME_DAEMON = "daemon";
const std::string SUBMODLE_NAME_ENDPOINT = "endpoint";
const std::string SUBMODLE_NAME_TOKENIZER = "tokenizer";
const std::string SUBMODLE_NAME_INFERINSTANCE = "infer_instance";
const std::string SUBMODLE_NAME_HEALTHCHECKER = "health_checker";
const std::string MINDIE_ERRORCODE_HEAD = "MIE";
const std::string MINDIE_SERVER_CODE = "04";
const std::string INFO = "I";
const std::string WARNING = "W";
const std::string ERROR = "E";
const std::string CRITICAL = "C";
const std::string SUBMODLE_CODE_DAEMON = "01";
const std::string SUBMODLE_CODE_ENDPOINT = "02";
const std::string SUBMODLE_CODE_TOKENIZER = "04";
const std::string SUBMODLE_CODE_INFERINSTANCE = "06";
const std::string SUBMODLE_CODE_HEALTHCHECKER = "07";
const std::string SUBMODLE_FEATURE_INIT = "01";
const std::string SUBMODLE_FEATURE_SERVER_REQUEST = "02";
const std::string SUBMODLE_FEATURE_MANAGE_REQUEST = "03";
const std::string SUBMODLE_FEATURE_SINGLE_INFERENCE = "04";
const std::string SUBMODLE_FEATURE_MULTI_INFERENCE = "05";
const std::string SUBMODLE_FEATURE_TOKENIZER = "06";
const std::string SUBMODLE_FEATURE_DETOKENIZER = "07";
const std::string SUBMODLE_FEATURE_RESPONSE = "08";
const std::string SUBMODLE_FEATURE_SPLITWISE = "09";
const std::string SUBMODLE_FEATURE_SPLITFUSE = "0A";
const std::string SUBMODLE_FEATURE_PREFIX_CACHE = "0B";
const std::string SUBMODLE_FEATURE_OCCUPYING = "0C";
const std::string SUBMODLE_FEATURE_RECOMPUTE = "0D";
const std::string SUBMODLE_FEATURE_SCHEDULER_POLICY = "0E";
const std::string SUBMODLE_FEATURE_PROFILING = "0F";
const std::string SUBMODLE_FEATURE_HOT_CONFIG = "10";
const std::string SUBMODLE_FEATURE_SECURE = "11";
const std::string SUBMODLE_FEATURE_FAULT_CONTROL = "12";
const std::string PERMISSION_ERROR = "01";
const std::string SUBPROCESS_ERROR = "02";
const std::string STARTUP_ERROR = "03";
const std::string PARAM_PARSE_ERROR = "04";
const std::string INFERENCE_GENERATE_REQUEST_ERROR = "05";
const std::string STATUS_WARNING = "06";
const std::string CHECK_ERROR = "07";
const std::string LOCAL_INVOKING_ERROR = "08";
const std::string SYSTEM_INVOKING_ERROR = "09";
const std::string TENSOR_ERROR = "0A";
const std::string ENCODE_DECODE_ERROR = "0B";
const std::string RESPONSE_PROCESS_ERROR = "0C";
const std::string RESPONSE_GENERATE_ERROR = "0D";
const std::string JSON_PARSE_ERROR = "0E";
const std::string TIMEOUT_WARNING = "0F";
const std::string EMPTY_RESPONSE_WARNING = "10";
const std::string PULL_KV_ERROR = "11";
const std::string RECOMPUTE_ERROR = "12";
const std::string SECURITY_ERROR = "13";
const std::string ABNORMAL_TRANSMISSION_ERROR = "14";
const std::string CHECK_WARNING = "15";
const std::string UNKNOWN_ERROR = "16";
const std::string DOWNLOAD_ERROR = "17";
const std::string REMOVE_ERROR = "18";
const std::string WATTING_SUBPROCESS_WARNING = "19";
const std::string EXIT_SUBPROCESS_WARNING = "1A";
const std::string CONFIG_ERROR = "1B";
const std::string INIT_ERROR = "1C";
const std::string SIMULATE_NORMAL = "20";
inline std::string GenerateDaemonErrCode(const std::string &level, const std::string &featType,
const std::string &errType) {
std::stringstream ss;
ss << "[" + MINDIE_ERRORCODE_HEAD + MINDIE_SERVER_CODE + level + SUBMODLE_CODE_DAEMON + featType + errType + "] ";
return ss.str();
}
inline std::string GenerateEndpointErrCode(const std::string &level, const std::string &featType,
const std::string &errType) {
std::stringstream ss;
ss << "[" + MINDIE_ERRORCODE_HEAD + MINDIE_SERVER_CODE + level + SUBMODLE_CODE_ENDPOINT + featType + errType + "] ";
return ss.str();
}
inline std::string GenerateTokenizerErrCode(const std::string &level, const std::string &featType,
const std::string &errType) {
std::stringstream ss;
ss << "[" + MINDIE_ERRORCODE_HEAD + MINDIE_SERVER_CODE + level + SUBMODLE_CODE_TOKENIZER + featType + errType +
"] ";
return ss.str();
}
inline std::string GenerateInferInstanceErrCode(const std::string &level, const std::string &featType,
const std::string &errType) {
std::stringstream ss;
ss << "[" + MINDIE_ERRORCODE_HEAD + MINDIE_SERVER_CODE + level + SUBMODLE_CODE_INFERINSTANCE + featType + errType +
"] ";
return ss.str();
}
inline std::string GenerateHealthCheckerErrCode(const std::string &level, const std::string &featType,
const std::string &errType) {
return "[" + MINDIE_ERRORCODE_HEAD + MINDIE_SERVER_CODE + level + SUBMODLE_CODE_HEALTHCHECKER + featType + errType +
"] ";
}
}
#endif