From 56fb91f3c2441c714a7f8ad9f5f7e7aa5bcfd1a4 Mon Sep 17 00:00:00 2001 From: Henrique Moody Date: Fri, 11 Apr 2014 19:55:24 -0300 Subject: [PATCH] Remove new live from default error_log formatter error_log() function already insert a new line at end of the given message, this commit just remove the new line at end to remove the new live duplication. --- src/Monolog/Formatter/ErrorLogFormatter.php | 20 ++++++++++++++++++++ src/Monolog/Handler/ErrorLogHandler.php | 9 +++++++++ 2 files changed, 29 insertions(+) create mode 100644 src/Monolog/Formatter/ErrorLogFormatter.php diff --git a/src/Monolog/Formatter/ErrorLogFormatter.php b/src/Monolog/Formatter/ErrorLogFormatter.php new file mode 100644 index 00000000..57765ed3 --- /dev/null +++ b/src/Monolog/Formatter/ErrorLogFormatter.php @@ -0,0 +1,20 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Formatter; + +/** + * @author Henrique Moody + */ +class ErrorLogFormatter extends LineFormatter +{ + const SIMPLE_FORMAT = "[%datetime%] %channel%.%level_name%: %message% %context% %extra%"; +} diff --git a/src/Monolog/Handler/ErrorLogHandler.php b/src/Monolog/Handler/ErrorLogHandler.php index 9e11c3b7..d151e172 100644 --- a/src/Monolog/Handler/ErrorLogHandler.php +++ b/src/Monolog/Handler/ErrorLogHandler.php @@ -11,6 +11,7 @@ namespace Monolog\Handler; +use Monolog\Formatter\ErrorLogFormatter; use Monolog\Logger; /** @@ -53,6 +54,14 @@ class ErrorLogHandler extends AbstractProcessingHandler ); } + /** + * {@inheritDoc} + */ + protected function getDefaultFormatter() + { + return new ErrorLogFormatter(); + } + /** * {@inheritdoc} */