OSDN Git Service

Add unit test code
[ultramonkey-l7/ultramonkey-l7-v3.git] / l7vsd / unit_tests / parameter_test / logger_stub / logger.h
1 /*le  logger.h
2  * @brief logger module creation class.
3  *
4  * L7VSD: Linux Virtual Server for Layer7 Load Balancing
5  * Copyright (C) 2009  NTT COMWARE Corporation.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Lesser General Public License for more details.
16  *      
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  *
22  **********************************************************************/
23
24 #ifndef LOGGER_H
25 #define LOGGER_H
26
27 #include <string>
28 #include <logger_enum.h>
29 namespace l7vs{
30
31 //! @class Logger
32 //! @brief Logger creation class.
33 //! @brief this class create Logger Inmlement class and mediate function.
34 class Logger{
35 protected:
36         const LOG_CATEGORY_TAG  scopedLogCategory;
37         const unsigned int              scopedLogId;
38         const std::string               scopedLogMessage;
39         const char*                             scopedLogFile;
40         const int                               scopedLogLine;
41
42 public:
43         //! default constructor creates implement class.
44         Logger();
45
46         //! log output constractor
47         //! scoped log output( Logger destractor output log)
48         //! @param[in]  Log output category tag
49         //! @param[in]  log id
50         //! @param[in]  log message
51         //!     @param[in]      filename        (=__FILE__)
52         //! @param[in]  lineno          (=__LINE__)
53         Logger( LOG_CATEGORY_TAG, const unsigned int, const std::string&, const char*, int);
54
55         //! destructor.(output log then use log output constractor)
56         ~Logger();
57
58         //! load Configuration.
59         void loadConf();
60
61         //! retrieve category's log level.
62         //! @param[in]  logcategory
63         //! @return             loglevel
64         static LOG_LEVEL_TAG getLogLevel( LOG_CATEGORY_TAG );
65
66         //! retrieve all category's log level.
67         //! @param[in]  logcategory
68         //! @return             loglevel
69         static void getLogLevelAll( category_level_list_type& );
70
71         //! set category's log level.
72         //!     @param[in]      logcategory
73         //!     @param[in]      loglevel
74         //!     @return true    success loglevel change
75         //!     @return false   failer loglevel change
76         static bool setLogLevel(LOG_CATEGORY_TAG cat, LOG_LEVEL_TAG level);
77
78         //! set all category's log level.
79         //!     @param[in]      logcategory
80         //!     @param[in]      loglevel
81         //!     @return true    success loglevel change
82         //!     @return false   failer loglevel change
83         static bool setLogLevelAll( LOG_LEVEL_TAG level );
84
85         //! output fatal log.
86         //! @param[in]  Log output category tag
87         //! @param[in]  log id
88         //! @param[in]  log message
89         //!     @param[in]      filename        (=__FILE__)
90         //! @param[in]  lineno          (=__LINE__)
91         static void putLogFatal( LOG_CATEGORY_TAG, const unsigned int, const std::string&, const char*, int );
92
93         //! output error log.
94         //! @param[in]  Log output category tag
95         //! @param[in]  log id
96         //! @param[in]  log message
97         //!     @param[in]      filename        (=__FILE__)
98         //! @param[in]  lineno          (=__LINE__)
99         static void putLogError(LOG_CATEGORY_TAG, const unsigned int, const std::string&, const char*, int );
100
101         //! output warn log.
102         //! @param[in]  Log output category tag
103         //! @param[in]  log id
104         //! @param[in]  log message
105         //!     @param[in]      filename        (=__FILE__)
106         //! @param[in]  lineno          (=__LINE__)
107         static void putLogWarn(LOG_CATEGORY_TAG, const unsigned int, const std::string&, const char*, int );
108
109         //! output info log.
110         //! @param[in]  Log output category tag
111         //! @param[in]  log id
112         //! @param[in]  log message
113         //!     @param[in]      filename        (=__FILE__)
114         //! @param[in]  lineno          (=__LINE__)
115         static void putLogInfo(LOG_CATEGORY_TAG, const unsigned int, const std::string&, const char*, int );
116
117         //! output debug log.
118         //! @param[in]  Log output category tag
119         //! @param[in]  log id
120         //! @param[in]  log message
121         //!     @param[in]      filename        (=__FILE__)
122         //! @param[in]  lineno          (=__LINE__)
123         static void putLogDebug(LOG_CATEGORY_TAG, const unsigned int, const std::string&, const char*, int );
124
125         //! set snmp sendtrap function
126         //! @param   snmp send trap function object
127         //! @retrun  void
128         static void     setSnmpSendtrap( const snmpSendtrapFuncType func );
129 };
130 }       //namespace l7vs
131
132 #endif  //LOGGER_H
133