gloox  0.9.9.12
logsink.h
1 /*
2  Copyright (c) 2005-2008 by Jakob Schroeter <js@camaya.net>
3  This file is part of the gloox library. http://camaya.net/gloox
4 
5  This software is distributed under a license. The full license
6  agreement can be found in the file LICENSE in this distribution.
7  This software may not be copied, modified, sold or distributed
8  other than expressed in the named license agreement.
9 
10  This software is distributed without any warranty.
11 */
12 
13 
14 #ifndef LOGSINK_H__
15 #define LOGSINK_H__
16 
17 #include "gloox.h"
18 #include "loghandler.h"
19 
20 #include <string>
21 // #include <fstream>
22 
23 namespace gloox
24 {
25 
38  class GLOOX_API LogSink
39  {
40  public:
44  LogSink();
45 
49  virtual ~LogSink();
50 
57  void log( LogLevel level, LogArea area, const std::string& message ) const;
58 
66  void registerLogHandler( LogLevel level, int areas, LogHandler *lh );
67 
72  void removeLogHandler( LogHandler *lh );
73 
74  private:
75  struct LogInfo
76  {
77  LogLevel level;
78  int areas;
79  };
80 
81  LogSink( const LogSink& /*copy*/ ) {}
82 
83  typedef std::map<LogHandler*, LogInfo> LogHandlerMap;
84  LogHandlerMap m_logHandlers;
85 
86  int m_fileFilter;
87 
88  };
89 
90 }
91 
92 #endif // LOGSINK_H__