log4cplus 2.0.8
layout.h
Go to the documentation of this file.
1// -*- C++ -*-
2// Module: Log4CPLUS
3// File: Layout.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_LAYOUT_HEADER_
25#define LOG4CPLUS_LAYOUT_HEADER_
26
27#include <log4cplus/config.hxx>
28
29#if defined (LOG4CPLUS_HAVE_PRAGMA_ONCE)
30#pragma once
31#endif
32
33#include <log4cplus/loglevel.h>
34#include <log4cplus/streams.h>
35#include <log4cplus/tstring.h>
37
38#include <vector>
39#include <memory>
40
41
42namespace log4cplus {
43
44 // Forward Declarations
45 namespace pattern
46 {
47
48 class PatternConverter;
49
50 }
51
52
53 namespace helpers
54 {
55
56 class Properties;
57
58 }
59
60
61 namespace spi
62 {
63
65
66 }
67
68
74 {
75 public:
77 Layout(const helpers::Properties& properties);
78 virtual ~Layout() = 0;
79
82
83 protected:
85
86 private:
87 // Disable copy
88 Layout(const Layout&);
89 Layout& operator=(Layout const &);
90 };
91
92
93
105 : public Layout
106 {
107 public:
110 virtual ~SimpleLayout();
111
114
115 private:
116 // Disallow copying of instances of this class
118 SimpleLayout& operator=(const SimpleLayout&);
119 };
120
121
122
166 : public Layout
167 {
168 public:
169 TTCCLayout(bool use_gmtime = false, bool thread_printing = true,
170 bool category_prefixes = true, bool context_printing = true);
172 virtual ~TTCCLayout();
173
176
177 bool getThreadPrinting() const;
179
182
183 bool getContextPrinting() const;
185
186 protected:
188 bool use_gmtime = false;
189 bool thread_printing = true;
190 bool category_prefixing = true;
191 bool context_printing = true;
192
193 private:
194 // Disallow copying of instances of this class
195 TTCCLayout(const TTCCLayout&);
196 TTCCLayout& operator=(const TTCCLayout&);
197 };
198
199
201
202
617 : public Layout
618 {
619 public:
620 // Ctors and dtor
623 virtual ~PatternLayout();
624
627
628 protected:
629 void init(const log4cplus::tstring& pattern, unsigned ndcMaxDepth = 0);
630
631 // Data
633 std::vector<std::unique_ptr<pattern::PatternConverter> > parsedPattern;
634
635 private:
636 // Disallow copying of instances of this class
638 PatternLayout& operator=(const PatternLayout&);
639 };
640
641
642
643} // end namespace log4cplus
644
645#endif // LOG4CPLUS_LAYOUT_HEADER_
This class is used to layout strings sent to an log4cplus::Appender.
Definition: layout.h:74
Layout(const helpers::Properties &properties)
virtual ~Layout()=0
LogLevelManager & llmCache
Definition: layout.h:84
virtual void formatAndAppend(log4cplus::tostream &output, const log4cplus::spi::InternalLoggingEvent &event)=0
This class is used to "manage" LogLevel definitions.
Definition: loglevel.h:130
A flexible layout configurable with pattern string.
Definition: layout.h:618
std::vector< std::unique_ptr< pattern::PatternConverter > > parsedPattern
Definition: layout.h:633
PatternLayout(const log4cplus::tstring &pattern)
log4cplus::tstring pattern
Definition: layout.h:632
virtual void formatAndAppend(log4cplus::tostream &output, const log4cplus::spi::InternalLoggingEvent &event)
PatternLayout(const log4cplus::helpers::Properties &properties)
void init(const log4cplus::tstring &pattern, unsigned ndcMaxDepth=0)
SimpleLayout consists of the LogLevel of the log statement, followed by " - " and then the log messag...
Definition: layout.h:106
SimpleLayout(const log4cplus::helpers::Properties &properties)
virtual void formatAndAppend(log4cplus::tostream &output, const log4cplus::spi::InternalLoggingEvent &event)
TTCC layout format consists of time, thread, Logger and nested diagnostic context information,...
Definition: layout.h:167
bool getContextPrinting() const
void setCategoryPrefixing(bool)
void setContextPrinting(bool)
void setThreadPrinting(bool)
bool getCategoryPrefixing() const
TTCCLayout(const log4cplus::helpers::Properties &properties)
virtual void formatAndAppend(log4cplus::tostream &output, const log4cplus::spi::InternalLoggingEvent &event)
TTCCLayout(bool use_gmtime=false, bool thread_printing=true, bool category_prefixes=true, bool context_printing=true)
log4cplus::tstring dateFormat
Definition: layout.h:187
bool getThreadPrinting() const
The internal representation of logging events.
Definition: loggingevent.h:51
This header defines the LogLevel type.
chrono::time_point< Clock, Duration > Time
Definition: timehelper.h:54
std::basic_string< tchar > tstring
Definition: tstring.h:39
std::basic_ostream< tchar > tostream
Definition: streams.h:40
LOG4CPLUS_EXPORT helpers::Time const & getTTCCLayoutTimeBase()
#define LOG4CPLUS_EXPORT
Definition: win32.h:141