laminas / laminas-log

Robust, composite logger with filtering, formatting, and PSR-3 support
https://docs.laminas.dev/laminas-log/
BSD 3-Clause "New" or "Revised" License
26 stars 30 forks source link

Error and exception handlers doesn't call a previous handler #3

Closed weierophinney closed 3 years ago

weierophinney commented 4 years ago

The previously defined error and exception handlers (if any) will be lost: https://github.com/zendframework/zend-log/blob/master/src/Logger.php#L562 https://github.com/zendframework/zend-log/blob/master/src/Logger.php#L611

error_reporting(E_ALL);

set_error_handler(function () {
    // We will never get here :-(
    echo 'Previous error handler';
    return true;
});

$logger = new \Zend\Log\Logger([
    'exceptionhandler' => true,
    'errorhandler' => true,
    'writers' => [
        [
            'name' => 'Stream',
            'options' => [
                'stream' => './data/logs/' . date('Y-m-d') . '.log',
            ],
        ],
    ],
]);

trigger_error('Error', E_USER_ERROR);

Originally posted by @27cm at https://github.com/zendframework/zend-log/issues/60

weierophinney commented 3 years ago

This package is considered feature-complete, and is now in security-only maintenance mode, following a decision by the Technical Steering Committee. If you have a security issue, please follow our security reporting guidelines. If you wish to take on the role of maintainer, please nominate yourself

If you are looking for an actively maintained package alternative, we recommend: