fix: rename LogLevel enums to kStyle to avoid windows.h ERROR macro conflict (#435)

Windows.h defines ERROR as a macro which collides with LogLevel::ERROR.
Rename all LogLevel enum values to kDebug/kInfo/kWarn/kError/kFatal style,
and remove the now-unnecessary #undef ERROR workaround in jieba_tokenizer.
This commit is contained in:
egolearner
2026-06-02 11:32:50 +08:00
committed by GitHub
parent 23a1ef815e
commit 8d79f74214
4 changed files with 21 additions and 25 deletions
@@ -46,12 +46,12 @@ inline bool iequals(const std::string &a, const std::string &b) {
}
GlobalConfig::LogLevel str_to_loglevel(const std::string &s) {
if (iequals(s, "debug")) return GlobalConfig::LogLevel::DEBUG;
if (iequals(s, "info")) return GlobalConfig::LogLevel::INFO;
if (iequals(s, "debug")) return GlobalConfig::LogLevel::kDebug;
if (iequals(s, "info")) return GlobalConfig::LogLevel::kInfo;
if (iequals(s, "warn") || iequals(s, "warning"))
return GlobalConfig::LogLevel::WARN;
if (iequals(s, "error")) return GlobalConfig::LogLevel::ERROR;
if (iequals(s, "fatal")) return GlobalConfig::LogLevel::FATAL;
return GlobalConfig::LogLevel::kWarn;
if (iequals(s, "error")) return GlobalConfig::LogLevel::kError;
if (iequals(s, "fatal")) return GlobalConfig::LogLevel::kFatal;
throw py::value_error("Invalid log level: ");
}