1 | <?php |
||
14 | class MonologSysLogWriter extends \Zend_Log_Writer_Abstract { |
||
15 | |||
16 | /** |
||
17 | * @var array Convert Zend_Log level to Monolog level. |
||
18 | */ |
||
19 | protected $priorities = array( |
||
20 | \Zend_Log::EMERG => \Monolog\Logger::EMERGENCY, |
||
21 | \Zend_Log::ALERT => \Monolog\Logger::ALERT, |
||
22 | \Zend_Log::CRIT => \Monolog\Logger::CRITICAL, |
||
23 | \Zend_Log::ERR => \Monolog\Logger::ERROR, |
||
24 | \Zend_Log::WARN => \Monolog\Logger::WARNING, |
||
25 | \Zend_Log::NOTICE => \Monolog\Logger::NOTICE, |
||
26 | \Zend_Log::INFO => \Monolog\Logger::INFO, |
||
27 | \Zend_Log::DEBUG => \Monolog\Logger::DEBUG, |
||
28 | ); |
||
29 | |||
30 | /** |
||
31 | * @var Monolog\Logger |
||
32 | */ |
||
33 | protected $monolog; |
||
34 | |||
35 | /** |
||
36 | * @param string $ident String identifying the application within the syslog stream. |
||
37 | * @param $facility Syslog facility. |
||
38 | */ |
||
39 | public function __construct($ident = 'SilverStripe_log', $facility = LOG_USER) { |
||
46 | |||
47 | static public function factory($config) { |
||
50 | |||
51 | protected function _write($event) { |
||
72 | |||
73 | } |
||
74 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.