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');

Helper logger

php
logger('Something went wrong'); // Same as Log::error(...)

© PageBlocks 2019-present