Class Log
A simple static class for logging messages in MODX. Wraps around modx()->log() and supports different log levels.
Log levels
| Constant | Value | Description |
|---|---|---|
LEVEL_FATAL | 0 | Critical error |
LEVEL_ERROR | 1 | Standard error |
LEVEL_WARN | 2 | Warning message |
LEVEL_INFO | 3 | Informational message |
LEVEL_DEBUG | 4 | Debugging information |
Methods
php
Log::fatal('Fatal error occurred');
Log::error('Request failed');
Log::warn('Configuration warning');
Log::info('Task completed successfully');
Log::debug('Debug details');From a template or a one-liner
There is no logger() function. The short forms are console() and dd() — see Helpers. Both write at ERROR level, and dd() does not stop the page despite the name.
php
console('Something went wrong', $payload);