OSDN Git Service

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