log4shib 2.0.0
|
00001 /* 00002 * PatternLayout.hh 00003 * 00004 * Copyright 2002, Bastiaan Bakker. All rights reserved. 00005 * 00006 * See the COPYING file for the terms of usage and distribution. 00007 */ 00008 00009 #ifndef _LOG4SHIB_PATTERNLAYOUT_HH 00010 #define _LOG4SHIB_PATTERNLAYOUT_HH 00011 00012 #include <log4shib/Portability.hh> 00013 #include <log4shib/Layout.hh> 00014 #include <log4shib/Configurator.hh> 00015 #include <vector> 00016 #ifdef LOG4SHIB_HAVE_SSTREAM 00017 #include <sstream> 00018 #endif 00019 00020 namespace log4shib { 00021 00025 class LOG4SHIB_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 00056 virtual std::string format(const LoggingEvent& event); 00057 00082 virtual void setConversionPattern(const std::string& conversionPattern) 00083 throw(ConfigureFailure); 00084 00085 virtual std::string getConversionPattern() const; 00086 00087 virtual void clearConversionPattern(); 00088 00089 class LOG4SHIB_EXPORT PatternComponent { 00090 public: 00091 inline virtual ~PatternComponent() {}; 00092 virtual void append(std::ostringstream& out, const LoggingEvent& event) = 0; 00093 }; 00094 00095 private: 00096 typedef std::vector<PatternComponent*> ComponentVector; 00097 ComponentVector _components; 00098 00099 std::string _conversionPattern; 00100 }; 00101 } 00102 00103 #endif // _LOG4SHIB_PATTERNLAYOUT_HH