log4cplus 2.0.8
loglog.h
Go to the documentation of this file.
1// -*- C++ -*-
2// Module: Log4CPLUS
3// File: loglog.h
4// Created: 6/2001
5// Author: Tad E. Smith
6//
7//
8// Copyright 2001-2017 Tad E. Smith
9//
10// Licensed under the Apache License, Version 2.0 (the "License");
11// you may not use this file except in compliance with the License.
12// You may obtain a copy of the License at
13//
14// http://www.apache.org/licenses/LICENSE-2.0
15//
16// Unless required by applicable law or agreed to in writing, software
17// distributed under the License is distributed on an "AS IS" BASIS,
18// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19// See the License for the specific language governing permissions and
20// limitations under the License.
21
24#ifndef LOG4CPLUS_HELPERS_LOGLOG
25#define LOG4CPLUS_HELPERS_LOGLOG
26
27#include <log4cplus/config.hxx>
28
29#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
30#pragma once
31#endif
32
33#include <log4cplus/tstring.h>
34#include <log4cplus/streams.h>
36
37
38namespace log4cplus {
39 namespace helpers {
40
55 {
56 public:
58 typedef LogLog * Ptr;
59
63 static Ptr getLogLog();
64
65
69 void setInternalDebugging(bool enabled);
70
77 void setQuietMode(bool quietMode);
78
83 void debug(const log4cplus::tstring& msg) const;
84 void debug(tchar const * msg) const;
85
93 void error(const log4cplus::tstring& msg, bool throw_flag = false) const;
94 void error(tchar const * msg, bool throw_flag = false) const;
95
101 void warn(const log4cplus::tstring& msg) const;
102 void warn(tchar const * msg) const;
103
104 // Public ctor and dtor to be used only by internal::DefaultContext.
106 virtual ~LogLog();
107
108 private:
109 enum TriState
110 {
111 TriUndef = -1,
112 TriFalse,
113 TriTrue
114 };
115
116 template <typename StringType>
118 void logging_worker (tostream & os,
119 bool (LogLog:: * cond) () const, tchar const *,
120 StringType const &, bool throw_flag = false) const;
121
122 LOG4CPLUS_PRIVATE static void set_tristate_from_env (TriState *,
123 tchar const * envvar);
124
125 LOG4CPLUS_PRIVATE bool get_quiet_mode () const;
126 LOG4CPLUS_PRIVATE bool get_not_quiet_mode () const;
127 LOG4CPLUS_PRIVATE bool get_debug_mode () const;
128
129 // Data
130 mutable TriState debugEnabled;
131 mutable TriState quietMode;
132 thread::Mutex mutex;
133
135 LOG4CPLUS_PRIVATE LogLog & operator = (LogLog const &);
136 };
137
139
140 } // end namespace helpers
141} // end namespace log4cplus
142
143
144#endif // LOG4CPLUS_HELPERS_LOGLOG
145
This class used to output log statements from within the log4cplus package.
Definition loglog.h:55
void warn(tchar const *msg) const
static Ptr getLogLog()
Returns a reference to the LogLog singleton.
void debug(const log4cplus::tstring &msg) const
This method is used to output log4cplus internal debug statements.
void error(const log4cplus::tstring &msg, bool throw_flag=false) const
This method is used to output log4cplus internal error statements.
void setQuietMode(bool quietMode)
In quite mode no LogLog generates strictly no output, not even for errors.
void debug(tchar const *msg) const
void error(tchar const *msg, bool throw_flag=false) const
void warn(const log4cplus::tstring &msg) const
This method is used to output log4cplus internal warning statements.
LogLog * Ptr
Return type of getLogLog().
Definition loglog.h:58
void setInternalDebugging(bool enabled)
Allows to enable/disable log4cplus internal logging.
#define LOG4CPLUS_PRIVATE
Definition config.hxx:53
LOG4CPLUS_EXPORT LogLog & getLogLog()
std::basic_string< tchar > tstring
Definition tstring.h:39
char tchar
Definition tchar.h:56
std::basic_ostream< tchar > tostream
Definition streams.h:40
#define LOG4CPLUS_EXPORT
Definition win32.h:141