Apache log4cxx Version 0.13.0
Loading...
Searching...
No Matches
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#include <mutex>
24
25namespace log4cxx
26{
27namespace helpers
28{
42class LOG4CXX_EXPORT LogLog
43{
44 private:
45 bool debugEnabled;
46
50 bool quietMode;
51 std::mutex mutex;
52 LogLog();
53 LogLog(const LogLog&);
54 LogLog& operator=(const LogLog&);
55 static LogLog& getInstance();
56
57
58 public:
62 static void setInternalDebugging(bool enabled);
63
68 static void debug(const LogString& msg);
69 static void debug(const LogString& msg, const std::exception& e);
70
71
77 static void error(const LogString& msg);
78 static void error(const LogString& msg, const std::exception& e);
79
80
87 static void setQuietMode(bool quietMode);
88
94 static void warn(const LogString& msg);
95 static void warn(const LogString& msg, const std::exception& e);
96
97 private:
98 static void emit(const LogString& msg);
99 static void emit(const std::exception& ex);
100};
101} // namespace helpers
102} // namespace log4cxx
103
104#define LOGLOG_DEBUG(log) { \
105 log4cxx::helpers::LogLog::debug(log) ; }
106
107#define LOGLOG_WARN(log) { \
108 log4cxx::helpers::LogLog::warn(log) ; }
109
110#define LOGLOG_ERROR(log) { \
111 log4cxx::helpers::LogLog::warn(log); }
112
113#endif //_LOG4CXX_HELPERS_LOG_LOG_H
This class used to output log statements from within the log4cxx package.
Definition: loglog.h:43
static void error(const LogString &msg)
This method is used to output log4cxx internal error statements.
static void error(const LogString &msg, const std::exception &e)
static void debug(const LogString &msg, const std::exception &e)
static void warn(const LogString &msg, const std::exception &e)
static void setQuietMode(bool quietMode)
In quiet mode LogLog generates strictly no output, not even for errors.
static void setInternalDebugging(bool enabled)
Allows to enable/disable log4cxx internal logging.
static void warn(const LogString &msg)
This method is used to output log4cxx internal warning statements.
static void debug(const LogString &msg)
This method is used to output log4cxx internal debug statements.
Definition: messagehandler.h:23
std::basic_string< logchar > LogString
Definition: logstring.h:66