OSDN Git Service

058653136834a94225f73c60ab64c5e9a89a5f0e
[ultramonkey-l7/sslproxy.git] / logger / logger.h
1 /*\r
2  * @file  logger.h\r
3  * @brief logger module creation class.\r
4  *\r
5  * L7VSD: Linux Virtual Server for Layer7 Load Balancing\r
6  * Copyright (C) 2008  NTT COMWARE Corporation.\r
7  *\r
8  * This program is free software; you can redistribute it and/or\r
9  * modify it under the terms of the GNU Lesser General Public\r
10  * License as published by the Free Software Foundation; either\r
11  * version 2.1 of the License, or (at your option) any later version.\r
12  *\r
13  * This program is distributed in the hope that it will be useful,\r
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
16  * Lesser General Public License for more details.\r
17  *      \r
18  * You should have received a copy of the GNU Lesser General Public\r
19  * License along with this library; if not, write to the Free Software\r
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\r
21  * 02110-1301 USA\r
22  *\r
23  **********************************************************************/\r
24 \r
25 #ifndef __LOGGER_H__\r
26 #define __LOGGER_H__\r
27 \r
28 #include <string>\r
29 #include <logger_enum.h>\r
30 \r
31 #define BUF_LEN (4096)\r
32 #define DEBUG_STR_LEN (4096)\r
33 \r
34 namespace l7vs\r
35 {\r
36         /*!\r
37          *  Logger creation class.\r
38          *  this class create Logger Inmlement class and mediate function.\r
39          */\r
40         class Logger\r
41         {\r
42         public:\r
43                 //! default constructor creates implement class.\r
44                 Logger();\r
45                 //! destructor.\r
46                 ~Logger();\r
47                 /*!\r
48                  * returns single instance.\r
49                  *\r
50                  * @param   void\r
51                  * @return  instance\r
52                  */             \r
53                 static Logger& getInstance() {\r
54                         return instance;\r
55                 }\r
56                 //! load Configuration.\r
57                 void loadConf();\r
58                 //! retrieve category's log level.\r
59                 LOG_LEVEL_TAG getLogLevel(LOG_CATEGORY_TAG cat);\r
60                 //! set category's log level.\r
61                 bool setLogLevel(LOG_CATEGORY_TAG cat, LOG_LEVEL_TAG level);\r
62                 //! output fatal log.\r
63                 void putLogFatal(LOG_CATEGORY_TAG cat, const unsigned int message_id, const std::string& message, const char *file, int line);\r
64                 //! output error log.\r
65                 void putLogError(LOG_CATEGORY_TAG cat, const unsigned int message_id, const std::string& message, const char *file, int line);\r
66                 //! output warn log.\r
67                 void putLogWarn(LOG_CATEGORY_TAG cat, const unsigned int message_id, const std::string& message, const char *file, int line);\r
68                 //! output info log.\r
69                 void putLogInfo(LOG_CATEGORY_TAG cat, const unsigned int message_id, const std::string& message, const char *file, int line);\r
70                 //! output debug log.\r
71                 void putLogDebug(LOG_CATEGORY_TAG cat, const unsigned int message_id, const std::string& message, const char *file, int line);\r
72 \r
73         protected:\r
74                 /*!\r
75                  * static instance initialize before main. \r
76                  * instance will defined in main program.\r
77                  */\r
78                 static Logger instance;\r
79         };\r
80 }       //namespace l7vs\r
81 \r
82 #endif  //__LOGGER_H__\r