OSDN Git Service

Merge pull request #36314 (suigintoh/ultramonkey-l7-v3/fix_signum_cast into master).
[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
32 //! @class Logger
33 //! @brief Logger creation class.
34 //! @brief this class create Logger Inmlement class and mediate function.
35 class Logger
36 {
37 protected:
38         const LOG_CATEGORY_TAG  scopedLogCategory;
39         const unsigned int      scopedLogId;
40         const std::string       scopedLogMessage;
41         const char             *scopedLogFile;
42         const int               scopedLogLine;
43
44 public:
45         //! default constructor creates implement class.
46         Logger();
47
48         //! log output constractor
49         //! scoped log output( Logger destractor output log)
50         //! @param[in]  Log output category tag
51         //! @param[in]  log id
52         //! @param[in]  log message
53         //! @param[in]  filename    (=__FILE__)
54         //! @param[in]  lineno      (=__LINE__)
55         Logger(LOG_CATEGORY_TAG, const unsigned int, const std::string &, const char *, int);
56
57         //! destructor.(output log then use log output constractor)
58         ~Logger();
59
60         //! load Configuration.
61         void loadConf();
62
63         //! retrieve category's log level.
64         //! @param[in]  logcategory
65         //! @return     loglevel
66         static LOG_LEVEL_TAG getLogLevel(LOG_CATEGORY_TAG);
67
68         //! retrieve all category's log level.
69         //! @param[in]  logcategory
70         //! @return     loglevel
71         static void getLogLevelAll(category_level_list_type &);
72
73         //! set category's log level.
74         //! @param[in]  logcategory
75         //! @param[in]  loglevel
76         //! @return true    success loglevel change
77         //! @return false   failer loglevel change
78         static bool setLogLevel(LOG_CATEGORY_TAG cat, LOG_LEVEL_TAG level);
79
80         //! set all category's log level.
81         //! @param[in]  logcategory
82         //! @param[in]  loglevel
83         //! @return true    success loglevel change
84         //! @return false   failer loglevel change
85         static bool setLogLevelAll(LOG_LEVEL_TAG level);
86
87         //! output fatal log.
88         //! @param[in]  Log output category tag
89         //! @param[in]  log id
90         //! @param[in]  log message
91         //! @param[in]  filename    (=__FILE__)
92         //! @param[in]  lineno      (=__LINE__)
93         static void putLogFatal(LOG_CATEGORY_TAG, const unsigned int, const std::string &, const char *, int);
94
95         //! output error log.
96         //! @param[in]  Log output category tag
97         //! @param[in]  log id
98         //! @param[in]  log message
99         //! @param[in]  filename    (=__FILE__)
100         //! @param[in]  lineno      (=__LINE__)
101         static void putLogError(LOG_CATEGORY_TAG, const unsigned int, const std::string &, const char *, int);
102
103         //! output warn log.
104         //! @param[in]  Log output category tag
105         //! @param[in]  log id
106         //! @param[in]  log message
107         //! @param[in]  filename    (=__FILE__)
108         //! @param[in]  lineno      (=__LINE__)
109         static void putLogWarn(LOG_CATEGORY_TAG, const unsigned int, const std::string &, const char *, int);
110
111         //! output info log.
112         //! @param[in]  Log output category tag
113         //! @param[in]  log id
114         //! @param[in]  log message
115         //! @param[in]  filename    (=__FILE__)
116         //! @param[in]  lineno      (=__LINE__)
117         static void putLogInfo(LOG_CATEGORY_TAG, const unsigned int, const std::string &, const char *, int);
118
119         //! output debug log.
120         //! @param[in]  Log output category tag
121         //! @param[in]  log id
122         //! @param[in]  log message
123         //! @param[in]  filename    (=__FILE__)
124         //! @param[in]  lineno      (=__LINE__)
125         static void putLogDebug(LOG_CATEGORY_TAG, const unsigned int, const std::string &, const char *, int);
126
127         //! set snmp sendtrap function
128         //! @param   snmp send trap function object
129         //! @retrun  void
130         static void setSnmpSendtrap(const snmpSendtrapFuncType func);
131 };
132 }   //namespace l7vs
133
134 #endif  //LOGGER_H
135