Monolog: Handler to catch errors/exceptions and output the messages in the response (as per PHP default) -
how can configure monolog output php errors within response, have been done without monolog?
what want when, example, php e_error occurs within php page, error message output response, , passed other handlers set monolog.
afaik, might use streamhandler , have output stdout, don't know how or if work expected?
there 2 variations i'd option of:
- monolog re-formats error message before having output within response
- monolog relays error (or exception) php native error handling outputs message in same format in response if monolog not mediating it
how achieve these? don't know how can monolog register handler exceptions , errors. need write own functions pass register_error_handler()
, register_exception_handler()
, register_shutdown_function()
?
short version:
use monolog\errorhandler; $logger = new logger('logger name'); errorhandler::register($logger);
longer, more customizable version:
use monolog\errorhandler; $logger = new logger('logger name'); $handler = new errorhandler($logger); $handler->registererrorhandler([], false); $handler->registerexceptionhandler(); $handler->registerfatalhandler();
Comments
Post a Comment