gloox 1.0
|
00001 /* 00002 Copyright (c) 2005-2009 by Jakob Schroeter <js@camaya.net> 00003 This file is part of the gloox library. http://camaya.net/gloox 00004 00005 This software is distributed under a license. The full license 00006 agreement can be found in the file LICENSE in this distribution. 00007 This software may not be copied, modified, sold or distributed 00008 other than expressed in the named license agreement. 00009 00010 This software is distributed without any warranty. 00011 */ 00012 00013 00014 #ifndef LOGSINK_H__ 00015 #define LOGSINK_H__ 00016 00017 #include "gloox.h" 00018 #include "loghandler.h" 00019 00020 #include <string> 00021 // #include <fstream> 00022 00023 namespace gloox 00024 { 00025 00038 class GLOOX_API LogSink 00039 { 00040 public: 00044 LogSink(); 00045 00049 virtual ~LogSink(); 00050 00058 void log( LogLevel level, LogArea area, const std::string& message ) const; 00059 00066 void dbg( LogArea area, const std::string& message ) const 00067 { log( LogLevelDebug, area, message ); } 00068 00075 void warn( LogArea area, const std::string& message ) const 00076 { log( LogLevelWarning, area, message ); } 00077 00084 void err( LogArea area, const std::string& message ) const 00085 { log( LogLevelError, area, message ); } 00086 00094 void registerLogHandler( LogLevel level, int areas, LogHandler* lh ); 00095 00100 void removeLogHandler( LogHandler* lh ); 00101 00102 private: 00103 struct LogInfo 00104 { 00105 LogLevel level; 00106 int areas; 00107 }; 00108 00109 LogSink( const LogSink& /*copy*/ ); 00110 00111 typedef std::map<LogHandler*, LogInfo> LogHandlerMap; 00112 LogHandlerMap m_logHandlers; 00113 00114 }; 00115 00116 } 00117 00118 #endif // LOGSINK_H__