<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Class Poco::PatternFormatter</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <meta name="author" content="Applied Informatics Software Engineering GmbH and Contributors"/> <meta name="publisher" content="Applied Informatics Software Engineering GmbH and Contributors"/> <meta name="copyright" content="Copyright (c) 2009, Applied Informatics Software Engineering GmbH and Contributors"/> <meta name="language" content="en"/> <meta name="date" content="2009-11-24"/> <meta name="generator" content="PocoDoc"/> <link rel="stylesheet" href="css/styles.css" type="text/css"/> </head> <body bgcolor="#ffffff" leftmargin="0" topmargin="0"> <div class="header"> <h1 class="namespace"><a href="Poco.html" class="namespace">Poco</a></h1> <h1 class="symbol">class PatternFormatter</h1> </div> <div class="body"> <p> <b>Library:</b> Foundation<br /> <b>Package:</b> Logging<br /> <b>Header:</b> Poco/PatternFormatter.h</p> <h2>Description</h2> <div class="description"> <p>This <a href="Poco.Formatter.html" title="class Poco::Formatter">Formatter</a> allows for custom formatting of log messages based on format patterns. </p> <p>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. </p> <p></p> <ul> <li>%s - message source </li> <li>%t - message text </li> <li>%l - message priority level (1 .. 7) </li> <li>%p - message priority (Fatal, Critical, Error, Warning, Notice, Information, Debug, Trace) </li> <li>%q - abbreviated message priority (F, C, E, W,N, I, D, T) </li> <li>%P - message process identifier </li> <li>%T - message thread name </li> <li>%I - message thread identifier (numeric) </li> <li>%N - node or host name </li> <li>%w - message date/time abbreviated weekday (Mon, Tue, ...) </li> <li>%W - message date/time full weekday (Monday, Tuesday, ...) </li> <li>%b - message date/time abbreviated month (Jan, Feb, ...) </li> <li>%B - message date/time full month (January, February, ...) </li> <li>%d - message date/time zero-padded day of month (01 .. 31) </li> <li>%e - message date/time day of month (1 .. 31) </li> <li>%f - message date/time space-padded day of month ( 1 .. 31) </li> <li>%m - message date/time zero-padded month (01 .. 12) </li> <li>%n - message date/time month (1 .. 12) </li> <li>%o - message date/time space-padded month ( 1 .. 12) </li> <li>%y - message date/time year without century (70) </li> <li>%Y - message date/time year with century (1970) </li> <li>%H - message date/time hour (00 .. 23) </li> <li>%h - message date/time hour (00 .. 12) </li> <li>%a - message date/time am/pm </li> <li>%A - message date/time AM/PM </li> <li>%M - message date/time minute (00 .. 59) </li> <li>%S - message date/time second (00 .. 59) </li> <li>%i - message date/time millisecond (000 .. 999) </li> <li>%c - message date/time centisecond (0 .. 9) </li> <li>%F - message date/time fractional seconds/microseconds (000000 - 999999) </li> <li>%z - time zone differential in ISO 8601 format (Z or +NN.NN). </li> <li>%Z - time zone differential in RFC format (GMT or +NNNN) </li> <li>%[name] - the value of the message parameter with the given name </li> <li>%% - percent sign </li> </ul> </div> <h2>Inheritance</h2> <p><b>Direct Base Classes: </b><a href="Poco.Formatter.html" title="class Poco::Formatter">Formatter</a></p> <p><b>All Base Classes: </b><a href="Poco.Configurable.html" title="class Poco::Configurable">Configurable</a>, <a href="Poco.Formatter.html" title="class Poco::Formatter">Formatter</a>, <a href="Poco.RefCountedObject.html" title="class Poco::RefCountedObject">RefCountedObject</a></p> <h2>Member Summary</h2> <p><b>Member Functions: </b><a href="Poco.PatternFormatter.html#9332" title="Poco::PatternFormatter::fmt()">fmt</a>, <a href="Poco.PatternFormatter.html#9339" title="Poco::PatternFormatter::fmt0()">fmt0</a>, <a href="Poco.PatternFormatter.html#9320" title="Poco::PatternFormatter::format()">format</a>, <a href="Poco.PatternFormatter.html#9330" title="Poco::PatternFormatter::getPriorityName()">getPriorityName</a>, <a href="Poco.PatternFormatter.html#9326" title="Poco::PatternFormatter::getProperty()">getProperty</a>, <a href="Poco.PatternFormatter.html#9323" title="Poco::PatternFormatter::setProperty()">setProperty</a></p> <p><b>Inherited Functions: </b><a href="Poco.RefCountedObject.html#9659" title="Poco::RefCountedObject::duplicate()">duplicate</a>, <a href="Poco.Formatter.html#7145" title="Poco::Formatter::format()">format</a>, <a href="Poco.Configurable.html#4278" title="Poco::Configurable::getProperty()">getProperty</a>, <a href="Poco.RefCountedObject.html#9661" title="Poco::RefCountedObject::referenceCount()">referenceCount</a>, <a href="Poco.RefCountedObject.html#9660" title="Poco::RefCountedObject::release()">release</a>, <a href="Poco.Configurable.html#4275" title="Poco::Configurable::setProperty()">setProperty</a></p> <h2>Constructors</h2> <h3><a name="9316">PatternFormatter</a></h3> <p class="decl"><a href="Poco.PatternFormatter.html" title="class Poco::PatternFormatter">PatternFormatter</a>();</p> <div class="description"> <p>Creates a <a href="Poco.PatternFormatter.html" title="class Poco::PatternFormatter">PatternFormatter</a>. The format pattern must be specified with a call to setProperty. </p> </div> <h3><a name="9317">PatternFormatter</a></h3> <p class="decl"><a href="Poco.PatternFormatter.html" title="class Poco::PatternFormatter">PatternFormatter</a>(<br /> const std::string & format<br />);</p> <div class="description"> <p>Creates a <a href="Poco.PatternFormatter.html" title="class Poco::PatternFormatter">PatternFormatter</a> that uses the given format pattern. </p> </div> <h2>Destructor</h2> <h3><a name="9319">~PatternFormatter</a> <img src="images/virtual.gif" alt="virtual" title="virtual" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">~<a href="Poco.PatternFormatter.html" title="class Poco::PatternFormatter">PatternFormatter</a>();</p> <div class="description"> <p>Destroys the <a href="Poco.PatternFormatter.html" title="class Poco::PatternFormatter">PatternFormatter</a>. </p> </div> <h2>Member Functions</h2> <h3><a name="9320">format</a> <img src="images/virtual.gif" alt="virtual" title="virtual" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">void format(<br /> const <a href="Poco.Message.html" title="class Poco::Message">Message</a> & msg,<br /> std::string & text<br />);</p> <div class="description"> <p>Formats the message according to the specified format pattern and places the result in text. </p> </div> <div class="description"><p><b>See also:</b> <a href="Poco.Formatter.html#7145" title="Poco::Formatter::format()">Poco::Formatter::format()</a></p></div> <h3><a name="9326">getProperty</a> <img src="images/virtual.gif" alt="virtual" title="virtual" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">std::string getProperty(<br /> const std::string & name<br />) const;</p> <div class="description"> <p>Returns the value of the property with the given name or throws a PropertyNotSupported exception if the given name is not recognized. </p> </div> <div class="description"><p><b>See also:</b> <a href="Poco.Formatter.html#7151" title="Poco::Formatter::getProperty()">Poco::Formatter::getProperty()</a></p></div> <h3><a name="9323">setProperty</a> <img src="images/virtual.gif" alt="virtual" title="virtual" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">void setProperty(<br /> const std::string & name,<br /> const std::string & value<br />);</p> <div class="description"> <p>Sets the property with the given name to the given value. </p> <p>The following properties are supported: </p> <p></p> <ul> <li>pattern: The format pattern. See the <a href="Poco.PatternFormatter.html" title="class Poco::PatternFormatter">PatternFormatter</a> class for details. </li> <li>times: Specifies whether times are adjusted for local time or taken as they are in UTC. Supported values are "local" and "UTC". </li> </ul> <p>If any other property name is given, a PropertyNotSupported exception is thrown. </p> </div> <div class="description"><p><b>See also:</b> <a href="Poco.Formatter.html#7148" title="Poco::Formatter::setProperty()">Poco::Formatter::setProperty()</a></p></div> <h3><a name="9332">fmt</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static void fmt(<br /> std::string & str,<br /> int value<br />);</p> <div class="description"> <p></p> </div> <h3><a name="9335">fmt</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static void fmt(<br /> std::string & str,<br /> int value,<br /> int width<br />);</p> <div class="description"> <p></p> </div> <h3><a name="9339">fmt0</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static void fmt0(<br /> std::string & str,<br /> int value,<br /> int width<br />);</p> <div class="description"> <p></p> </div> <h3><a name="9330">getPriorityName</a> <img src="images/protected.gif" alt="protected" title="protected" style="vertical-align:baseline;" border="0" /> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static const std::string & getPriorityName(<br /> int<br />);</p> <div class="description"> <p>Returns a string for the given priority value. </p> </div> <h2>Variables</h2> <h3><a name="9328">PROP_PATTERN</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static const std::string <a href="Poco.PatternFormatter.html#9328" title="Poco::PatternFormatter::PROP_PATTERN">PROP_PATTERN</a>;</p> <div class="description"> <p></p> </div> <h3><a name="9329">PROP_TIMES</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3> <p class="decl">static const std::string <a href="Poco.PatternFormatter.html#9329" title="Poco::PatternFormatter::PROP_TIMES">PROP_TIMES</a>;</p> <div class="description"> <p></p> </div> <p class="footer">POCO C++ Libraries 1.3.6-all<br /> Copyright © 2009, <a href="http://pocoproject.org/" target="_blank">Applied Informatics Software Engineering GmbH and Contributors</a></p> </div> </body> </html>