Apache log4cxx  Version 0.12.0
loglog.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef _LOG4CXX_HELPERS_LOG_LOG_H
19 #define _LOG4CXX_HELPERS_LOG_LOG_H
20 
21 #include <log4cxx/logstring.h>
22 #include <exception>
23 
24 namespace log4cxx
25 {
26 namespace helpers
27 {
41 class LOG4CXX_EXPORT LogLog
42 {
43  private:
44  bool debugEnabled;
45 
49  bool quietMode;
50  std::mutex mutex;
51  LogLog();
52  LogLog(const LogLog&);
53  LogLog& operator=(const LogLog&);
54  static LogLog& getInstance();
55 
56 
57  public:
61  static void setInternalDebugging(bool enabled);
62 
67  static void debug(const LogString& msg);
68  static void debug(const LogString& msg, const std::exception& e);
69 
70 
76  static void error(const LogString& msg);
77  static void error(const LogString& msg, const std::exception& e);
78 
79 
86  static void setQuietMode(bool quietMode);
87 
93  static void warn(const LogString& msg);
94  static void warn(const LogString& msg, const std::exception& e);
95 
96  private:
97  static void emit(const LogString& msg);
98  static void emit(const std::exception& ex);
99 };
100 } // namespace helpers
101 } // namespace log4cxx
102 
103 #define LOGLOG_DEBUG(log) { \
104  log4cxx::helpers::LogLog::debug(log) ; }
105 
106 #define LOGLOG_WARN(log) { \
107  log4cxx::helpers::LogLog::warn(log) ; }
108 
109 #define LOGLOG_ERROR(log) { \
110  log4cxx::helpers::LogLog::warn(log); }
111 
112 #endif //_LOG4CXX_HELPERS_LOG_LOG_H
This class used to output log statements from within the log4cxx package.
Definition: loglog.h:41
Definition: appender.h:32
std::basic_string< logchar > LogString
Definition: logstring.h:66