Apache Log4cxx  Version 1.2.0
Loading...
Searching...
No Matches
log4cxx::pattern::DatePatternConverter Class Reference

Convert and format a date or timestamp into a string. More...

#include <datepatternconverter.h>

Inheritance diagram for log4cxx::pattern::DatePatternConverter:
log4cxx::pattern::LoggingEventPatternConverter log4cxx::pattern::PatternConverter log4cxx::helpers::Object

Public Member Functions

 DatePatternConverter (const OptionsList &options)
 An object that can convert a date or timestamp to the format described by the conversion specifier in the first element in options.
 
 ~DatePatternConverter ()
 
void format (const spi::LoggingEventPtr &event, LogString &output, helpers::Pool &p) const override
 Append to output a textual version of the timestamp in event.
 
void format (const helpers::ObjectPtr &obj, LogString &output, helpers::Pool &p) const override
 Append to output a textual version of the date or timestamp in obj.
 
void format (const helpers::DatePtr &date, LogString &toAppendTo, helpers::Pool &p) const
 Append to toAppendTo a textual version of date.
 
- Public Member Functions inherited from log4cxx::pattern::LoggingEventPatternConverter
virtual void format (const spi::LoggingEventPtr &event, LogString &toAppendTo, helpers::Pool &p) const =0
 Formats an event into a string buffer.
 
void format (const helpers::ObjectPtr &obj, LogString &toAppendTo, helpers::Pool &p) const override
 Formats an object into a string buffer.
 
virtual bool handlesThrowable () const
 Normally pattern converters are not meant to handle Exceptions although few pattern converters might.
 
- Public Member Functions inherited from log4cxx::pattern::PatternConverter
virtual void format (const helpers::ObjectPtr &obj, LogString &toAppendTo, helpers::Pool &p) const =0
 Formats an object into a string buffer.
 
LogString getName () const
 This method returns the name of the conversion pattern.
 
virtual LogString getStyleClass (const helpers::ObjectPtr &e) const
 This method returns the CSS style class that should be applied to the LoggingEvent passed as parameter, which can be null.
 
- Public Member Functions inherited from log4cxx::helpers::Object
virtual ~Object ()
 
virtual const helpers::ClassgetClass () const =0
 
virtual bool instanceof (const Class &clazz) const =0
 
virtual const void * cast (const Class &clazz) const =0
 

Static Public Member Functions

static PatternConverterPtr newInstance (const std::vector< LogString > &options)
 An object that can convert a date or timestamp to the format described by the conversion specifier in the first element in options.
 

Additional Inherited Members

- Protected Member Functions inherited from log4cxx::pattern::LoggingEventPatternConverter
 LoggingEventPatternConverter (const LogString &name, const LogString &style)
 Constructs an instance of LoggingEventPatternConverter.
 
 LoggingEventPatternConverter (std::unique_ptr< PatternConverterPrivate > priv)
 
- Protected Member Functions inherited from log4cxx::pattern::PatternConverter
 PatternConverter (LOG4CXX_PRIVATE_PTR(PatternConverterPrivate) priv)
 
 PatternConverter (const LogString &name, const LogString &style)
 Create a new pattern converter.
 
virtual ~PatternConverter ()
 
- Static Protected Member Functions inherited from log4cxx::pattern::PatternConverter
static void append (LogString &toAppendTo, const std::string &src)
 Appends content in the locale code page to a LogString.
 

Detailed Description

Convert and format a date or timestamp into a string.

Constructor & Destructor Documentation

◆ DatePatternConverter()

log4cxx::pattern::DatePatternConverter::DatePatternConverter ( const OptionsList options)

An object that can convert a date or timestamp to the format described by the conversion specifier in the first element in options.

If the conversion specifier contains a % character, the date is formated using strftime.

Otherwise the conversion specifier must be a pattern compatible with java.text.SimpleDateFormat, "ABSOLUTE", "DATE" or "ISO8601". For example, "HH:mm:ss,SSS", "dd MMM yyyy HH:mm:ss,SSS" or "DATE".

ISO8601 format is assumed if the first element in options missing or empty.

If options has a second element, it is assumed to be a time zone specifier, for example, "GMT-6"

◆ ~DatePatternConverter()

log4cxx::pattern::DatePatternConverter::~DatePatternConverter ( )

Member Function Documentation

◆ format() [1/3]

void log4cxx::pattern::DatePatternConverter::format ( const helpers::DatePtr &  date,
LogString toAppendTo,
helpers::Pool p 
) const

Append to toAppendTo a textual version of date.

◆ format() [2/3]

void log4cxx::pattern::DatePatternConverter::format ( const helpers::ObjectPtr obj,
LogString output,
helpers::Pool p 
) const
overridevirtual

Append to output a textual version of the date or timestamp in obj.

Nothing is added to output if obj does not point to a Date or spi::LoggingEvent.

Implements log4cxx::pattern::PatternConverter.

◆ format() [3/3]

void log4cxx::pattern::DatePatternConverter::format ( const spi::LoggingEventPtr event,
LogString output,
helpers::Pool p 
) const
overridevirtual

Append to output a textual version of the timestamp in event.

Implements log4cxx::pattern::LoggingEventPatternConverter.

◆ newInstance()

static PatternConverterPtr log4cxx::pattern::DatePatternConverter::newInstance ( const std::vector< LogString > &  options)
static

An object that can convert a date or timestamp to the format described by the conversion specifier in the first element in options.

If the conversion specifier contains a % character, the date is formated using strftime.

Otherwise the conversion specifier must be a pattern compatible with java.text.SimpleDateFormat, "ABSOLUTE", "DATE" or "ISO8601". For example, "HH:mm:ss,SSS", "dd MMM yyyy HH:mm:ss,SSS" or "DATE".

ISO8601 format is assumed if the first element in options missing or empty.

If options has a second element, it is assumed to be a time zone specifier, for example, "GMT-6"


The documentation for this class was generated from the following file: