log4shib 2.0.0

PatternLayout.hh
Go to the documentation of this file.
1/*
2 * PatternLayout.hh
3 *
4 * Copyright 2002, Bastiaan Bakker. All rights reserved.
5 *
6 * See the COPYING file for the terms of usage and distribution.
7 */
8
9#ifndef _LOG4SHIB_PATTERNLAYOUT_HH
10#define _LOG4SHIB_PATTERNLAYOUT_HH
11
12#include <log4shib/Portability.hh>
13#include <log4shib/Layout.hh>
14#include <log4shib/Configurator.hh>
15#include <vector>
16#ifdef LOG4SHIB_HAVE_SSTREAM
17#include <sstream>
18#endif
19
20 namespace log4shib {
21
25 class LOG4SHIB_EXPORT PatternLayout : public Layout {
26 public:
30 static const char* DEFAULT_CONVERSION_PATTERN;
31
35 static const char* SIMPLE_CONVERSION_PATTERN;
36
40 static const char* BASIC_CONVERSION_PATTERN;
41
46 static const char* TTCC_CONVERSION_PATTERN;
47
48 PatternLayout();
49 virtual ~PatternLayout();
50
56 virtual std::string format(const LoggingEvent& event);
57
82 virtual void setConversionPattern(const std::string& conversionPattern)
83 throw(ConfigureFailure);
84
85 virtual std::string getConversionPattern() const;
86
87 virtual void clearConversionPattern();
88
89 class LOG4SHIB_EXPORT PatternComponent {
90 public:
91 inline virtual ~PatternComponent() {};
92 virtual void append(std::ostringstream& out, const LoggingEvent& event) = 0;
93 };
94
95 private:
96 typedef std::vector<PatternComponent*> ComponentVector;
97 ComponentVector _components;
98
99 std::string _conversionPattern;
100 };
101}
102
103#endif // _LOG4SHIB_PATTERNLAYOUT_HH
Configurator.hh
LOG4SHIB_EXPORT
#define LOG4SHIB_EXPORT
Definition: Export.hh:11
Layout.hh
Portability.hh
log4shib::ConfigureFailure
Exception class for configuration.
Definition: Configurator.hh:26
log4shib::Layout
Extend this abstract class to create your own log layout format.
Definition: Layout.hh:22
log4shib::PatternLayout::PatternComponent
Definition: PatternLayout.hh:89
log4shib::PatternLayout::PatternComponent::~PatternComponent
virtual ~PatternComponent()
Definition: PatternLayout.hh:91
log4shib::PatternLayout::PatternComponent::append
virtual void append(std::ostringstream &out, const LoggingEvent &event)=0
log4shib::PatternLayout
PatternLayout is a simple fixed format Layout implementation.
Definition: PatternLayout.hh:25
log4shib::PatternLayout::DEFAULT_CONVERSION_PATTERN
static const char * DEFAULT_CONVERSION_PATTERN
The default conversion pattern.
Definition: PatternLayout.hh:30
log4shib::PatternLayout::SIMPLE_CONVERSION_PATTERN
static const char * SIMPLE_CONVERSION_PATTERN
A conversion pattern equivalent to the SimpleLayout.
Definition: PatternLayout.hh:35
log4shib::PatternLayout::BASIC_CONVERSION_PATTERN
static const char * BASIC_CONVERSION_PATTERN
A conversion pattern equivalent to the BasicLayout.
Definition: PatternLayout.hh:40
log4shib::PatternLayout::TTCC_CONVERSION_PATTERN
static const char * TTCC_CONVERSION_PATTERN
A conversion pattern equivalent to the TTCCLayout.
Definition: PatternLayout.hh:46
std::ostringstream
Definition: Portability.hh:38
log4shib
The top level namespace for all 'Log for C++' types and classes.
Definition: AbortAppender.hh:16
log4shib::LoggingEvent
The internal representation of logging events.
Definition: LoggingEvent.hh:32