OSDN Git Service

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