You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4php-dev@logging.apache.org by ch...@apache.org on 2009/10/06 20:28:08 UTC
svn commit: r822412 - in /incubator/log4php/trunk/src/main/php/layouts:
LoggerLayoutHtml.php LoggerLayoutPattern.php LoggerLayoutSimple.php
LoggerLayoutTTCC.php LoggerLayoutXml.php
Author: chammers
Date: Tue Oct 6 18:28:08 2009
New Revision: 822412
URL: http://svn.apache.org/viewvc?rev=822412&view=rev
Log:
* Added @package for phpdoc
* Added @examples to phpdoc
Modified:
incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutHtml.php
incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutPattern.php
incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutSimple.php
incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutTTCC.php
incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutXml.php
Modified: incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutHtml.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutHtml.php?rev=822412&r1=822411&r2=822412&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutHtml.php (original)
+++ incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutHtml.php Tue Oct 6 18:28:08 2009
@@ -15,13 +15,33 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
+ * @package log4php
*/
/**
* This layout outputs events in a HTML table.
*
- * Parameters are: {@link $title}, {@link $locationInfo}.
+ * Configurable parameters for this layout are:
+ *
+ * - title
+ * - locationInfo
+ *
+ * An example for this layout:
+ *
+ * {@example ../../examples/php/layout_html.php}<br>
+ *
+ * The corresponding XML file:
+ *
+ * {@example ../../examples/resources/layout_html.properties}
+ *
+ * The above will print a HTML table that looks, converted back to plain text, like the following:<br>
+ * <pre>
+ * Log session start time Wed Sep 9 00:11:30 2009
*
+ * Time Thread Level Category Message
+ * 0 8318 INFO root Hello World!
+ * </pre>
+ *
* @version $Revision$
* @package log4php
* @subpackage layouts
Modified: incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutPattern.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutPattern.php?rev=822412&r1=822411&r2=822412&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutPattern.php (original)
+++ incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutPattern.php Tue Oct 6 18:28:08 2009
@@ -15,14 +15,28 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
+ * @package log4php
*/
/**
* A flexible layout configurable with pattern string.
+ *
+ * <p>Example:</p>
+ *
+ * {@example ../../examples/php/layout_pattern.php}<br>
+ *
+ * <p>with the following properties file:</p>
*
- * <p>The goal of this class is to {@link format()} a {@link LoggerLoggingEvent} and return the results as a string.
- * The results depend on the conversion pattern.
- * The conversion pattern is closely related to the conversion pattern of the printf function in C.
+ * {@example ../../examples/resources/layout_pattern.properties}<br>
+ *
+ * <p>would print the following:</p>
+ *
+ * <pre>
+ * 2009-09-09 00:27:35,787 [INFO] root: Hello World! (at src/examples/php/layout_pattern.php line 6)
+ * 2009-09-09 00:27:35,787 [DEBUG] root: Second line (at src/examples/php/layout_pattern.php line 7)
+ * </pre>
+ *
+ * <p>The conversion pattern is closely related to the conversion pattern of the printf function in C.
* A conversion pattern is composed of literal text and format control expressions called conversion specifiers.
* You are free to insert any literal text within the conversion pattern.</p>
*
@@ -32,23 +46,6 @@
* <p>The conversion character specifies the type of data, e.g. category, priority, date, thread name.
* The format modifiers control such things as field width, padding, left and right justification.</p>
*
- * The following is a simple example.
- *
- * <p>Let the conversion pattern be "%-5p [%t]: %m%n" and assume that the log4php environment
- * was set to use a LoggerPatternLayout.</p>
- *
- * Then the statements
- * <code>
- * $root = Logger::getRoot();
- * $root->debug("Message 1");
- * $root->warn("Message 2");
- * </code>
- * would yield the output
- * <pre>
- * DEBUG [main]: Message 1
- * WARN [main]: Message 2
- * </pre>
- *
* <p>Note that there is no explicit separator between text and conversion specifiers.</p>
*
* <p>The pattern parser knows when it has reached the end of a conversion specifier when it reads a conversion character.
@@ -132,7 +129,7 @@
* However, if category name is longer than 30 chars,
* then truncate from the beginning.
* </pre>
- *
+ *
* @version $Revision$
* @package log4php
* @subpackage layouts
@@ -145,10 +142,12 @@
/** Default conversion TTCC Pattern */
const TTCC_CONVERSION_PATTERN = '%r [%t] %p %c %x - %m%n';
- /** @var string */
+ /** The pattern.
+ * @var string */
private $pattern;
- /** @var LoggerPatternConverter head chain */
+ /** Head of a chain of Converters.
+ * @var LoggerPatternConverter */
private $head;
private $timezone;
Modified: incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutSimple.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutSimple.php?rev=822412&r1=822411&r2=822412&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutSimple.php (original)
+++ incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutSimple.php Tue Oct 6 18:28:08 2009
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
+ * @package log4php
*/
/**
@@ -22,8 +23,16 @@
*
* Returns the log statement in a format consisting of the
* <b>level</b>, followed by " - " and then the <b>message</b>.
- * For example,
- * <samp> INFO - A message </samp>
+ *
+ * For example the following php and properties files
+ *
+ * {@example ../../examples/php/layout_simple.php}<br>
+ *
+ * {@example ../../examples/resources/layout_simple.properties}<br>
+ *
+ * would result in:
+ *
+ * <samp>INFO - Hello World!</samp>
*
* @version $Revision$
* @package log4php
Modified: incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutTTCC.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutTTCC.php?rev=822412&r1=822411&r2=822412&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutTTCC.php (original)
+++ incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutTTCC.php Tue Oct 6 18:28:08 2009
@@ -15,11 +15,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
+ * @package log4php
*/
/**
- * TTCC layout format consists of time, thread, category and nested
- * diagnostic context information, hence the name.
+ * TTCC layout format consists of <b>t</b>ime, <b>t</b>hread, <b>c</b>ategory and nested
+ * diagnostic <b>c</b>ontext information, hence the name.
*
* <p>Each of the four fields can be individually enabled or
* disabled. The time format depends on the <b>DateFormat</b> used.</p>
@@ -27,13 +28,22 @@
* <p>If no dateFormat is specified it defaults to '%c'.
* See php {@link PHP_MANUAL#date} function for details.</p>
*
- * Params:
+ * Configurable parameters for this layout are:
* - {@link $threadPrinting} (true|false) enable/disable pid reporting.
* - {@link $categoryPrefixing} (true|false) enable/disable logger category reporting.
* - {@link $contextPrinting} (true|false) enable/disable NDC reporting.
* - {@link $microSecondsPrinting} (true|false) enable/disable micro seconds reporting in timestamp.
* - {@link $dateFormat} (string) set date format. See php {@link PHP_MANUAL#date} function for details.
*
+ * An example how to use this layout:
+ *
+ * {@example ../../examples/php/layout_ttcc.php}<br>
+ *
+ * {@example ../../examples/resources/layout_ttcc.properties}<br>
+ *
+ * The above would print:<br>
+ * <samp>02:28 [13714] INFO root - Hello World!</samp>
+ *
* @version $Revision$
* @package log4php
* @subpackage layouts
Modified: incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutXml.php
URL: http://svn.apache.org/viewvc/incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutXml.php?rev=822412&r1=822411&r2=822412&view=diff
==============================================================================
--- incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutXml.php (original)
+++ incubator/log4php/trunk/src/main/php/layouts/LoggerLayoutXml.php Tue Oct 6 18:28:08 2009
@@ -15,6 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
+ * @package log4php
*/
/**
@@ -25,6 +26,23 @@
* <p>It does not output a complete well-formed XML file.
* The output is designed to be included as an external entity in a separate file to form
* a correct XML file.</p>
+ *
+ * Example:
+ *
+ * {@example ../../examples/php/layout_xml.php}<br>
+ *
+ * {@example ../../examples/resources/layout_xml.properties}<br>
+ *
+ * The above would print:
+ *
+ * <pre>
+ * <log4php:eventSet xmlns:log4php="http://logging.apache.org/log4php/" version="0.3" includesLocationInfo="true">
+ * <log4php:event logger="root" level="INFO" thread="13802" timestamp="1252456226491">
+ * <log4php:message><![CDATA[Hello World!]]></log4php:message>
+ * <log4php:locationInfo class="main" file="examples/php/layout_xml.php" line="6" method="main" />
+ * </log4php:event>
+ * </log4php:eventSet>
+ * </pre>
*
* @version $Revision$
* @package log4php
@@ -44,11 +62,9 @@
const CDATA_EMBEDDED_END = ']]>]]><![CDATA[';
/**
- * The <b>LocationInfo</b> option takes a boolean value. By default,
- * it is set to false which means there will be no location
- * information output by this layout. If the the option is set to
- * true, then the file name and line number of the statement at the
- * origin of the log statement will be output.
+ * If set to true then the file name and line number of the origin of the
+ * log statement will be output.
+ *
* @var boolean
*/
private $locationInfo = true;
@@ -144,7 +160,9 @@
return "</{$this->_namespacePrefix}:eventSet>\r\n";
}
- /**
+
+ /** Whether or not file name and line number will be included in the output.
+ *
* @return boolean
*/
public function getLocationInfo() {