OSDN Git Service

Fixed chkconfig option
[ultramonkey-l7/ultramonkey-l7-v2.git] / logger / logger.cpp
1 /*
2  * @file  logger.cpp
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 #include <logger.h>
26 #include <logger_impl.h>
27
28 /*!
29  * default constructor.
30  * get instance of implement class, and initialize
31  * @param   void
32  * @return  void
33  */
34 l7vs::Logger::Logger()
35 {
36         if (!LoggerImpl::getInstance().init()) {
37                 exit(1);
38         }
39 }
40
41 /*!
42  * destructor.
43  * @param   void
44  * @return  void
45  */
46 l7vs::Logger::~Logger()
47 {
48 }
49
50 /*!
51  * retrieve category's log level.
52  * this is only wrapper to implement method.
53  * @param   category that want to know
54  * @return  log level
55  */
56 LOG_LEVEL_TAG l7vs::Logger::getLogLevel(LOG_CATEGORY_TAG cat)
57 {
58         return LoggerImpl::getInstance().getLogLevel(cat);
59 }
60
61 /*!
62  * set category's log level.
63  * this is only wrapper to implement method.
64  * @param   category to set log level
65  * @param   level
66  * @retval  true  succeed
67  * @retval  false failed
68  */
69 bool l7vs::Logger::setLogLevel(LOG_CATEGORY_TAG cat, LOG_LEVEL_TAG level)
70 {
71         return LoggerImpl::getInstance().setLogLevel(cat, level);
72 }
73
74 /*!
75  * output fatal log.
76  * this is only wrapper to implement method.
77  * @param   category that logging matter occured
78  * @param   log message id 
79  * @param   log message 
80  * @param   current file 
81  * @param   current line
82  * @retrun  void
83  */
84 void l7vs::Logger::putLogFatal(LOG_CATEGORY_TAG cat, const unsigned int message_id, const std::string& message, const char *file, int line)
85 {
86         LoggerImpl::getInstance().putLogFatal(cat, message_id, message, file, line);
87 }
88
89 /*!
90  * output errorl log.
91  * this is only wrapper to implement method.
92  * @param   category that logging matter occured
93  * @param   log message id 
94  * @param   log message 
95  * @param   current file 
96  * @param   current line
97  * @retrun  void
98  */
99 void l7vs::Logger::putLogError(LOG_CATEGORY_TAG cat, const unsigned int message_id, const std::string& message, const char *file, int line)
100 {
101         LoggerImpl::getInstance().putLogError(cat, message_id, message, file, line);
102 }
103
104 /*!
105  * output warn log.
106  * this is only wrapper to implement method.
107  * @param   category that logging matter occured
108  * @param   log message id 
109  * @param   log message 
110  * @param   current file 
111  * @param   current line
112  * @retrun  void
113  */
114 void l7vs::Logger::putLogWarn(LOG_CATEGORY_TAG cat, const unsigned int message_id, const std::string& message, const char *file, int line)
115 {
116         LoggerImpl::getInstance().putLogWarn(cat, message_id, message, file, line);
117 }
118
119 /*!
120  * output info log.
121  * this is only wrapper to implement method.
122  * @param   category that logging matter occured
123  * @param   log message id 
124  * @param   log message 
125  * @param   current file 
126  * @param   current line
127  * @retrun  void
128  */
129 void l7vs::Logger::putLogInfo(LOG_CATEGORY_TAG cat, const unsigned int message_id, const std::string& message, const char *file, int line)
130 {
131         LoggerImpl::getInstance().putLogInfo(cat, message_id, message, file, line);
132 }
133
134 /*!
135  * output debug log.
136  * this is only wrapper to implement method.
137  * @param   category that logging matter occured
138  * @param   log message id 
139  * @param   log message 
140  * @param   current file 
141  * @param   current line
142  * @retrun  void
143  */
144 void l7vs::Logger::putLogDebug(LOG_CATEGORY_TAG cat, const unsigned int message_id, const std::string& message, const char *file, int line)
145 {
146         LoggerImpl::getInstance().putLogDebug(cat, message_id, message, file, line);
147 }
148
149 /*!
150  * return start category by using module.
151  * this is only wrapper to implement method.
152  * @param   module
153  * @retrun  start category
154  */
155 LOG_CATEGORY_TAG l7vs::Logger::getCategoryRangeStart(LOG_MODULE_TAG mod)
156 {
157         return LoggerImpl::getInstance().getCategoryRangeStart(mod);
158 }
159
160 /*!
161  * return end category by using module.
162  * this is only wrapper to implement method.
163  * @param   module
164  * @retrun  end category
165  */
166 LOG_CATEGORY_TAG l7vs::Logger::getCategoryRangeEnd(LOG_MODULE_TAG mod)
167 {
168         return LoggerImpl::getInstance().getCategoryRangeEnd(mod);
169 }
170
171 /*!
172  * reload configuration.
173  * this is only wrapper to implement method.
174  * @param   void
175  * @return  void
176  */
177 void l7vs::Logger::loadConf()
178 {
179         LoggerImpl::getInstance().loadConf();
180 }