diff options
author | Luo Jinghua <sunmoon1997@gmail.com> | 2011-12-01 10:52:50 +0800 |
---|---|---|
committer | Luo Jinghua <sunmoon1997@gmail.com> | 2011-12-01 10:52:50 +0800 |
commit | b9f2ca7256eabb729036481b1a7eaa66c2403bb0 (patch) | |
tree | 6aea4577a72ff70e2b99036556b9bff0d5628ad9 | |
parent | 43ccf2982c7f3d5ce3b8865c5adede78b6e70f53 (diff) |
SexyAppFramework: Added another logging level
-rw-r--r-- | osframework/source/SexyAppFramework/SexyLog.cpp | 30 | ||||
-rw-r--r-- | osframework/source/SexyAppFramework/SexyLog.h | 5 |
2 files changed, 33 insertions, 2 deletions
diff --git a/osframework/source/SexyAppFramework/SexyLog.cpp b/osframework/source/SexyAppFramework/SexyLog.cpp index 81f34f0..8c5ca7b 100644 --- a/osframework/source/SexyAppFramework/SexyLog.cpp +++ b/osframework/source/SexyAppFramework/SexyLog.cpp @@ -7,11 +7,11 @@ namespace Sexy { static const char* LogNames[] = { - "debug", "info", "warn", "error" + "noise", "debug", "info", "warn", "error" }; const char* logLevelName(LogLevel level) { - if (level >= LOG_DEBUG && level < LOG_LEVEL_MAX) + if (level >= LOG_NOISE && level < LOG_LEVEL_MAX) return LogNames[level]; return "unknown"; @@ -72,6 +72,32 @@ void log(LogLevel lvl, const std::string& s) log(lvl, tag, s); } +void logn(const std::string& tag, const std::string& s) +{ + log(LOG_NOISE, tag, s); +} + +void logtfn(const std::string& tag, const char *fmt, ...) +{ + va_list argList; + va_start(argList, fmt); + std::string s = vformat(fmt, argList); + va_end(argList); + + log(LOG_NOISE, tag, s); +} + +void logfn(const char *fmt, ...) +{ + va_list argList; + va_start(argList, fmt); + std::string s = vformat(fmt, argList); + va_end(argList); + + std::string tag; + log(LOG_NOISE, tag, s); +} + void logd(const std::string& tag, const std::string& s) { log(LOG_DEBUG, tag, s); diff --git a/osframework/source/SexyAppFramework/SexyLog.h b/osframework/source/SexyAppFramework/SexyLog.h index 0370047..4e7aca2 100644 --- a/osframework/source/SexyAppFramework/SexyLog.h +++ b/osframework/source/SexyAppFramework/SexyLog.h @@ -6,6 +6,7 @@ namespace Sexy { enum LogLevel { + LOG_NOISE = -1, LOG_DEBUG, LOG_INFO, LOG_WARN, @@ -21,6 +22,10 @@ namespace Sexy { void log(LogLevel lvl, const std::string& tag, const std::string& s); void log(LogLevel lvl, const std::string& s); + void logn(const std::string& tag, const std::string& s); + void logtfn(const std::string& tag, const char* fmt, ...); + void logfn(const char* fmt, ...); + void logd(const std::string& tag, const std::string& s); void logtfd(const std::string& tag, const char* fmt, ...); void logfd(const char* fmt, ...); |