]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/logger.h
d32c3d1844e788b4cd9cd0e497ccbb1c12cc1fe4
[user/henk/code/inspircd.git] / include / logger.h
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
6  * See: http://www.inspircd.org/wiki/index.php/Credits
7  *
8  * This program is free but copyrighted software; see
9  *            the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 #ifndef __LOGMANAGER_H
15 #define __LOGMANAGER_H
16
17 class CoreExport LogStream : public classbase
18 {
19  protected:
20         InspIRCd *ServerInstance;
21         std::string type;
22  public:
23         LogStream(InspIRCd *Instance, const std::string &type)
24         {
25                 this->ServerInstance = Instance;
26                 this->type = type;
27         }
28
29         virtual void OnLog(int loglevel, const std::string &msg) { }
30 };
31
32 class CoreExport LogManager : public classbase
33 {
34  private:
35         InspIRCd *ServerInstance;
36         std::map<std::string, std::vector<LogStream *> > LogStreams;
37         std::vector<LogStream *> GlobalLogStreams; //holds all logstreams with a type of *
38  public:
39         LogManager(InspIRCd *Instance)
40         {
41                 ServerInstance = Instance;
42         }
43
44         bool AddLogType(const std::string &type, LogStream *l);
45         bool DelLogType(const std::string &type, LogStream *l);
46         void Log(const std::string &type, int loglevel, const std::string &msg);
47 };
48
49 #endif