Sfoglia il codice sorgente

Merge pull request #357 from henriquemoody/error_log

Remove new live from default error_log formatter
Jordi Boggiano 11 anni fa
parent
commit
7503e331cb

+ 20 - 0
src/Monolog/Formatter/ErrorLogFormatter.php

@@ -0,0 +1,20 @@
+<?php
+
+/*
+ * This file is part of the Monolog package.
+ *
+ * (c) Jordi Boggiano <j.boggiano@seld.be>
+ *
+ * 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 <henriquemoody@gmail.com>
+ */
+class ErrorLogFormatter extends LineFormatter
+{
+    const SIMPLE_FORMAT = "[%datetime%] %channel%.%level_name%: %message% %context% %extra%";
+}

+ 9 - 0
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}
      */