diff options
author | Chris Wilson <chris+github@qwirx.com> | 2008-09-26 20:22:26 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2008-09-26 20:22:26 +0000 |
commit | 3e51e918dafe8c6ab3ebc6e501ef15a8fc01a8ad (patch) | |
tree | 9814bf73556c0a9f5923b68abe8c4c14f380147f /lib/common/Logging.h | |
parent | 0493ea11b9e1b06af149551b49118bbf25c52ad2 (diff) |
Add file logger class.
Diffstat (limited to 'lib/common/Logging.h')
-rw-r--r-- | lib/common/Logging.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/common/Logging.h b/lib/common/Logging.h index 9a850c44..39e76740 100644 --- a/lib/common/Logging.h +++ b/lib/common/Logging.h @@ -15,6 +15,8 @@ #include <sstream> #include <vector> +#include "FileStream.h" + /* #define BOX_LOG(level, stuff) \ { \ @@ -115,6 +117,7 @@ class Logger public: Logger(); + Logger(Log::Level level); virtual ~Logger(); virtual bool Log(Log::Level level, const std::string& rFile, @@ -268,4 +271,24 @@ class Logging }; }; +class FileLogger : public Logger +{ + private: + FileStream mLogFile; + FileLogger(const FileLogger& forbidden) + : mLogFile("") { /* do not call */ } + + public: + FileLogger(const std::string& rFileName, Log::Level Level) + : Logger(Level), + mLogFile(rFileName, O_WRONLY | O_CREAT | O_APPEND) + { } + + virtual bool Log(Log::Level Level, const std::string& rFile, + int Line, std::string& rMessage); + + virtual const char* GetType() { return "FileLogger"; } + virtual void SetProgramName(const std::string& rProgramName) { } +}; + #endif // LOGGING__H |