log4cplus  2.1.0
consoleappender.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 // Module: Log4CPLUS
3 // File: consoleappender.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_CONSOLE_APPENDER_HEADER_
25 #define LOG4CPLUS_CONSOLE_APPENDER_HEADER_
26 
27 #include <log4cplus/config.hxx>
28 
29 #if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
30 #pragma once
31 #endif
32 
33 #include <log4cplus/appender.h>
34 #include <locale>
35 
36 namespace log4cplus {
73  public:
74  // Ctors
75  ConsoleAppender(bool logToStdErr = false, bool immediateFlush = false);
77 
78  // Dtor
80 
81  // Methods
82  virtual void close();
83 
87 
88  protected:
89  virtual void append(const spi::InternalLoggingEvent& event);
90 
91  // Data
98 
99  std::unique_ptr<std::locale> locale;
100  };
101 
102 } // end namespace log4cplus
103 
104 #endif // LOG4CPLUS_CONSOLE_APPENDER_HEADER_
105 
Extend this class for implementing your own strategies for printing log statements.
Definition: appender.h:139
ConsoleAppender appends log events to std::cout or std::cerr using a layout specified by the user.
static log4cplus::thread::Mutex const & getOutputMutex()
This mutex is used by ConsoleAppender and helpers::LogLog classes to synchronize output to console.
bool immediateFlush
Immediate flush means that the underlying output stream will be flushed at the end of each append ope...
virtual void append(const spi::InternalLoggingEvent &event)
Subclasses of Appender should implement this method to perform actual logging.
virtual void close()
Release any resources allocated within the appender such as file handles, network connections,...
std::unique_ptr< std::locale > locale
ConsoleAppender(const log4cplus::helpers::Properties &properties)
ConsoleAppender(bool logToStdErr=false, bool immediateFlush=false)
The internal representation of logging events.
Definition: loggingevent.h:51
#define LOG4CPLUS_EXPORT
Definition: win32.h:141