Library: Foundation
Package: Logging
Header: Poco/PatternFormatter.h
This Formatter allows for custom formatting of log messages based on format patterns.
The format pattern is used as a template to format the message and is copied character by character except for the following special characters, which are replaced by the corresponding value.
Direct Base Classes: Formatter
All Base Classes: Configurable, Formatter, RefCountedObject
Member Functions: format, getPriorityName, getProperty, setProperty
Inherited Functions: duplicate, format, getProperty, referenceCount, release, setProperty
Creates a PatternFormatter. The format pattern must be specified with a call to setProperty.
PatternFormatter(
const std::string & format
);
Creates a PatternFormatter that uses the given format pattern.
~PatternFormatter();
Destroys the PatternFormatter.
void format(
const Message & msg,
std::string & text
);
Formats the message according to the specified format pattern and places the result in text.
See also: Poco::Formatter::format()
std::string getProperty(
const std::string & name
) const;
Returns the value of the property with the given name or throws a PropertyNotSupported exception if the given name is not recognized.
See also: Poco::Formatter::getProperty()
void setProperty(
const std::string & name,
const std::string & value
);
Sets the property with the given name to the given value.
The following properties are supported:
If any other property name is given, a PropertyNotSupported exception is thrown.
See also: Poco::Formatter::setProperty()
static const std::string & getPriorityName(
int
);
Returns a string for the given priority value.
static const std::string PROP_PATTERN;
static const std::string PROP_TIMES;