00001
00002
00003
00004
00005
00006
00007
00008
00009
#ifndef _LOG4CPP_PATTERNLAYOUT_HH
00010
#define _LOG4CPP_PATTERNLAYOUT_HH
00011
00012
#include <log4cpp/Portability.hh>
00013
#include <log4cpp/Layout.hh>
00014
#include <log4cpp/Configurator.hh>
00015
#include <vector>
00016
#ifdef LOG4CPP_HAVE_SSTREAM
00017
#include <sstream>
00018
#endif
00019
00020
namespace log4cpp {
00021
00025 class LOG4CPP_EXPORT PatternLayout :
public Layout {
00026
public:
00030
static const char* DEFAULT_CONVERSION_PATTERN;
00031
00035
static const char* SIMPLE_CONVERSION_PATTERN;
00036
00040
static const char* BASIC_CONVERSION_PATTERN;
00041
00046
static const char* TTCC_CONVERSION_PATTERN;
00047
00048 PatternLayout();
00049
virtual ~PatternLayout();
00050
00051
00052
00053
00059
virtual std::string format(
const LoggingEvent& event);
00060
00084
virtual void setConversionPattern(
const std::string& conversionPattern)
00085
throw(
ConfigureFailure);
00086
00087
virtual std::string getConversionPattern()
const;
00088
00089
virtual void clearConversionPattern();
00090
00091 class LOG4CPP_EXPORT PatternComponent {
00092
public:
00093 inline virtual ~PatternComponent() {};
00094
virtual void append(
std::ostringstream& out,
const LoggingEvent& event) = 0;
00095 };
00096
00097
private:
00098
typedef std::vector<PatternComponent*> ComponentVector;
00099 ComponentVector _components;
00100
00101 std::string _conversionPattern;
00102 };
00103 }
00104
00105
#endif // _LOG4CPP_PATTERNLAYOUT_HH