cphalcon
cphalcon copied to clipboard
\Phalcon\Logger\Formatter\Line and $dateFormat
The documentation says:
Class Phalcon\Logger\Formatter\Line
Methods public __construct ([string $format], [string $dateFormat])
But the second parameter isn't works correctly
$logger = new \Phalcon\Logger\Adapter\Stream('php://output');
$formatter = new \Phalcon\Logger\Formatter\Line("%date%", 'Y-m-d');
$logger->setFormatter($formatter);
$logger->error('message');
// %28pm28Europe/Moscow%
// expected: 2013-02-28
Other cases
$formatter = new \Phalcon\Logger\Formatter\Line("string", 'Y-m-d');
// string
$formatter = new \Phalcon\Logger\Formatter\Line("%date%-string", 'Y-m-d');
// %28pm28Europe/Moscow%-4428Thu, 28 Feb 2013 16:16:44 +04001624-string
$formatter = new \Phalcon\Logger\Formatter\Line("%date%", true);
// %28pm28Europe/Moscow%
$formatter = new \Phalcon\Logger\Formatter\Line("%date%", false);
// %28pm28Europe/Moscow%
$formatter = new \Phalcon\Logger\Formatter\Line("%date%", null);
// Thu, 28 Feb 13 16:16:44 +0400
@Agent-J
You can always use the
$formatter->setFormat('Y-m-d');
Could you be so kind as to create failing tests and submit a pull request for the 1.0.0 branch so that we can fix this?
Thanks!!!
This is fixed in the 1.0.0 branch