|
|
@ -21,6 +21,7 @@ namespace log { |
|
|
|
static const char *g_LogLevelStr[eNumLogLevels] = |
|
|
|
static const char *g_LogLevelStr[eNumLogLevels] = |
|
|
|
{ |
|
|
|
{ |
|
|
|
"none", // eLogNone
|
|
|
|
"none", // eLogNone
|
|
|
|
|
|
|
|
"critical", // eLogCritical
|
|
|
|
"error", // eLogError
|
|
|
|
"error", // eLogError
|
|
|
|
"warn", // eLogWarning
|
|
|
|
"warn", // eLogWarning
|
|
|
|
"info", // eLogInfo
|
|
|
|
"info", // eLogInfo
|
|
|
@ -32,10 +33,11 @@ namespace log { |
|
|
|
* @note Using ISO 6429 (ANSI) color sequences |
|
|
|
* @note Using ISO 6429 (ANSI) color sequences |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
#ifdef _WIN32 |
|
|
|
#ifdef _WIN32 |
|
|
|
static const char *LogMsgColors[] = { "", "", "", "", "", "" }; |
|
|
|
static const char *LogMsgColors[] = { "", "", "", "", "", "", "" }; |
|
|
|
#else /* UNIX */ |
|
|
|
#else /* UNIX */ |
|
|
|
static const char *LogMsgColors[] = { |
|
|
|
static const char *LogMsgColors[] = { |
|
|
|
"\033[1;32m", /* none: green */ |
|
|
|
"\033[1;32m", /* none: green */ |
|
|
|
|
|
|
|
"\033[1;41m", /* critical: red background */ |
|
|
|
"\033[1;31m", /* error: red */ |
|
|
|
"\033[1;31m", /* error: red */ |
|
|
|
"\033[1;33m", /* warning: yellow */ |
|
|
|
"\033[1;33m", /* warning: yellow */ |
|
|
|
"\033[1;36m", /* info: cyan */ |
|
|
|
"\033[1;36m", /* info: cyan */ |
|
|
@ -53,6 +55,7 @@ namespace log { |
|
|
|
int priority = LOG_DEBUG; |
|
|
|
int priority = LOG_DEBUG; |
|
|
|
switch (l) { |
|
|
|
switch (l) { |
|
|
|
case eLogNone : priority = LOG_CRIT; break; |
|
|
|
case eLogNone : priority = LOG_CRIT; break; |
|
|
|
|
|
|
|
case eLogCritical: priority = LOG_CRIT; break; |
|
|
|
case eLogError : priority = LOG_ERR; break; |
|
|
|
case eLogError : priority = LOG_ERR; break; |
|
|
|
case eLogWarning : priority = LOG_WARNING; break; |
|
|
|
case eLogWarning : priority = LOG_WARNING; break; |
|
|
|
case eLogInfo : priority = LOG_INFO; break; |
|
|
|
case eLogInfo : priority = LOG_INFO; break; |
|
|
@ -124,6 +127,7 @@ namespace log { |
|
|
|
void Log::SetLogLevel (const std::string& level_) { |
|
|
|
void Log::SetLogLevel (const std::string& level_) { |
|
|
|
std::string level=str_tolower(level_); |
|
|
|
std::string level=str_tolower(level_); |
|
|
|
if (level == "none") { m_MinLevel = eLogNone; } |
|
|
|
if (level == "none") { m_MinLevel = eLogNone; } |
|
|
|
|
|
|
|
else if (level == "critical") { m_MinLevel = eLogCritical} |
|
|
|
else if (level == "error") { m_MinLevel = eLogError; } |
|
|
|
else if (level == "error") { m_MinLevel = eLogError; } |
|
|
|
else if (level == "warn") { m_MinLevel = eLogWarning; } |
|
|
|
else if (level == "warn") { m_MinLevel = eLogWarning; } |
|
|
|
else if (level == "info") { m_MinLevel = eLogInfo; } |
|
|
|
else if (level == "info") { m_MinLevel = eLogInfo; } |
|
|
|