This framework is based on log4j (see {@link http://jakarta.apache.org/log4j log4j} for details).
*Design, strategies and part of the methods documentation are developed by log4j team * (Ceki Gülcü as log4j project founder and * {@link http://jakarta.apache.org/log4j/docs/contributors.html contributors}).
* *PHP port, extensions and modifications by VxR. All rights reserved.
* For more information, please see {@link http://www.vxr.it/log4php/}.
This software is published under the terms of the LGPL License * a copy of which has been included with this distribution in the LICENSE file.
* * @package log4php * @subpackage layouts */ /** * @ignore */ if (!defined('LOG4PHP_DIR')) define('LOG4PHP_DIR', dirname(__FILE__) . '/..'); if (!defined('LOG4PHP_LINE_SEP')) { if (substr(php_uname(), 0, 7) == "Windows") { /** * @ignore */ define('LOG4PHP_LINE_SEP', "\r\n"); } else { /** * @ignore */ define('LOG4PHP_LINE_SEP', "\n"); } } /** */ require_once(LOG4PHP_DIR . '/LoggerLayout.php'); /** * String constant designating no time information. Current value of * this constant is NULL. */ define ('LOG4PHP_LOGGER_LAYOUT_NULL_DATE_FORMAT', 'NULL'); /** * String constant designating relative time. Current value of * this constant is RELATIVE. */ define ('LOG4PHP_LOGGER_LAYOUT_RELATIVE_TIME_DATE_FORMAT', 'RELATIVE'); /** * TTCC layout format consists of time, thread, category and nested * diagnostic context information, hence the name. * *Each of the four fields can be individually enabled or * disabled. The time format depends on the DateFormat used.
* *If no dateFormat is specified it defaults to '%c'. * See php {@link PHP_MANUAL#date} function for details.
* * Params: * - {@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. * * @author VxRTime, thread, category are printed depending on options. * * @param LoggerLoggingEvent $event * @return string */ function format($event) { $timeStamp = (float)$event->getTimeStamp(); $format = strftime($this->dateFormat, (int)$timeStamp); if ($this->microSecondsPrinting) { $usecs = round(($timeStamp - (int)$timeStamp) * 1000); $format .= sprintf(',%03d', $usecs); } $format .= ' '; if ($this->threadPrinting) $format .= '['.getmypid().'] '; $level = $event->getLevel(); $format .= $level->toString().' '; if($this->categoryPrefixing) { $format .= $event->getLoggerName().' '; } if($this->contextPrinting) { $ndc = $event->getNDC(); if($ndc != null) { $format .= $ndc.' '; } } $format .= '- '.$event->getRenderedMessage(); $format .= LOG4PHP_LINE_SEP; return $format; } function ignoresThrowable() { return true; } } ?>