Hello,
I would like to see a patch like this applied to the Log4php package, in
helpers/LoggerPatternConverter.php:
--- LoggerPatternConverter.php 2003-12-09 14:50:14.000000000 -0800
+++ LoggerPatternConverter.php 2006-01-16 11:00:09.000000000 -0800
@@ -286,7 +286,8 @@
{
$timeStamp = $event->getTimeStamp();
$usecs = round(($timeStamp - (int)$timeStamp) * 1000);
- $this->df = str_replace("\u", "u", ereg_replace("[^\\]u",
sprintf(',%03d', $usecs), $this->df));
+ $msecsep = defined('LOG4PHP_LOGGER_PATTERN_MSEC_SEPARATOR') ?
LOG4PHP_LOGGER_PATTERN_MSEC_SEPARATOR : ',';
+ $this->df = str_replace("\u", "u", preg_replace("/[^\\\]u/",
sprintf("{$msecsep}%03d", $usecs), $this->df));
return date($this->df, $event->getTimeStamp());
... Basically, I'd like to be able to easily define what the msec separator
is when I request msecs in my log configuration.
The patch above allows for that level of configuration, without breaking
backwards compatibility for those who expect a comma to be the separator.
The patch also replaces ereg_replace() function with the faster
preg_replace() version.
What do you guys think?
Regards,
Clay
--
Killersoft.com