silverstripe-webpack/app/_config/logs.yml
2020-12-28 11:13:27 +07:00

61 lines
1.8 KiB
YAML

---
Name: webapp-dev-errors
Only:
environment: dev
---
SilverStripe\Core\Injector\Injector:
Psr\Log\LoggerInterface.errorhandler:
calls:
pushMyDisplayErrorHandler: [pushHandler, ['%$DisplayErrorHandler']]
DisplayErrorHandler:
class: SilverStripe\Logging\HTTPOutputHandler
constructor:
- 'notice'
properties:
Formatter: '%$SilverStripe\Logging\DetailedErrorFormatter'
CLIFormatter: '%$SilverStripe\Logging\DetailedErrorFormatter'
---
Name: webapp-live-errors
Except:
environment: dev
---
SilverStripe\Core\Injector\Injector:
# Default logger implementation for general purpose use
Psr\Log\LoggerInterface:
calls:
# Save system logs to file
pushFileLogHandler: [pushHandler, ['%$LogFileHandler']]
# Core error handler for system use
Psr\Log\LoggerInterface.errorhandler:
calls:
# Save errors to file
pushFileLogHandler: [pushHandler, ['%$LogFileHandler']]
# Format and display errors in the browser/CLI
pushMyDisplayErrorHandler: [pushHandler, ['%$DisplayErrorHandler']]
# Custom handler to log to a file
LogFileHandler:
class: Monolog\Handler\StreamHandler
constructor:
- '../silverstripe.log'
- 'notice'
properties:
Formatter: '%$Monolog\Formatter\HtmlFormatter'
ContentType: text/html
# Handler for displaying errors in the browser or CLI
DisplayErrorHandler:
class: SilverStripe\Logging\HTTPOutputHandler
constructor:
- 'error'
properties:
Formatter: '%$SilverStripe\Logging\DebugViewFriendlyErrorFormatter'
# Configuration for the "friendly" error formatter
SilverStripe\Logging\DebugViewFriendlyErrorFormatter:
class: SilverStripe\Logging\DebugViewFriendlyErrorFormatter
properties:
Title: 'There has been an error'
Body: 'The website server has not been able to respond to your request'