bitz-server  1.0.0
logger.h
1 /*
2  * bitz-server, An ICAP server implementation in C++
3  * Copyright (C) 2012 Uditha Atukorala
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */
19 
20 #ifndef BITZ_LOGGER_H
21 #define BITZ_LOGGER_H
22 
23 #include <string>
24 #include <log4cpp/Category.hh>
25 
26 namespace bitz {
27 
28  class Logger {
29  public:
30  static Logger &instance( std::string log_file = "/dev/null" , std::string category = "logger" ) {
31  static Logger logger( log_file, category );
32  return logger;
33  }
34 
35  void initialise( std::string log_file, std::string category );
36 
37  static int getPriorityValue( const std::string& priority );
38  void log( int priority, const std::string &message );
39 
40  void fatal( const std::string& message );
41  void emerg( const std::string& message );
42  void alert( const std::string& message );
43  void crit( const std::string& message );
44  void error( const std::string& message );
45  void warn( const std::string& message );
46  void notice( const std::string& message );
47  void info( const std::string& message );
48  void debug( const std::string& message );
49 
50  private:
51  log4cpp::Category * LOGGER;
52 
53  Logger( std::string log_file, std::string category );
54  ~Logger();
55  Logger( Logger const &copy );
56  Logger &operator=( const Logger &copy );
57  };
58 
59 } /* end of namespace bitz */
60 
61 #endif /* !BITZ_LOGGER_H */
62 
Definition: echo.cpp:23
Definition: logger.h:28