Skip to content

Class Log ​

A simple static class for logging messages in MODX. Wraps around modx()->log() and supports different log levels.

Log levels ​

ConstantValueDescription
LEVEL_FATAL0Critical error
LEVEL_ERROR1Standard error
LEVEL_WARN2Warning message
LEVEL_INFO3Informational message
LEVEL_DEBUG4Debugging 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);

© PageBlocks 2019-present