NEW Separate core error logging from standard LoggerInterface

This commit is contained in:
Robbie Averill 2018-07-04 11:55:54 +12:00
parent a8853504b4
commit 1cb23178ec

View File

@ -1,21 +1,34 @@
--- ---
Name: logging Name: logging
--- ---
# Logging is built up of a chain containing: # Core error logging is built up of a chain containing:
# - A top level \ErrorHandler which registers the error service # - A top level \ErrorHandler which registers the error service
# - A \Logger which acts as the error service # - A \Logger which acts as the error service
# - A \HandlerInterface which handles errors for the logger # - A \HandlerInterface which handles errors for the logger
# - One or more \FormatterInterface which format errors for the handler # - One or more \FormatterInterface which format errors for the handler
#
# Logging for use outside of core error handling also uses the same implementations,
# but is available without the HandlerInterfaces attached
SilverStripe\Core\Injector\Injector: SilverStripe\Core\Injector\Injector:
SilverStripe\Logging\ErrorHandler: SilverStripe\Logging\ErrorHandler:
class: SilverStripe\Logging\MonologErrorHandler class: SilverStripe\Logging\MonologErrorHandler
properties: calls:
Logger: '%$Psr\Log\LoggerInterface' pushDefaultLogger: [ pushHandler, [ '%$Psr\Log\LoggerInterface' ] ]
pushErrorHandler: [ pushHandler, [ '%$Psr\Log\LoggerInterface.errorhandler' ] ]
# Default implementation for use as a standard logger. Up to developers to attach their own
# handlers
Psr\Log\LoggerInterface: Psr\Log\LoggerInterface:
type: singleton type: singleton
class: Monolog\Logger class: Monolog\Logger
constructor: constructor:
- "error-log" - "error-log"
# Core error handling
Psr\Log\LoggerInterface.errorhandler:
type: singleton
class: Monolog\Logger
constructor:
- "error-handler"
calls: calls:
pushDisplayErrorHandler: [ pushHandler, [ '%$Monolog\Handler\HandlerInterface' ] ] pushDisplayErrorHandler: [ pushHandler, [ '%$Monolog\Handler\HandlerInterface' ] ]
--- ---