T3DD12-Workshop: Refactoring TYPO3 Logging

Example usage of The Logging API

    /** @var $logger t3lib_log_Logger */
$logger = t3lib_log_LogManager::getLogger(__CLASS__);

    // Using the generic log method, you have to set the severity level
$logger->log(t3lib_log_Level::ERROR, 'Log Message');

    // Using the shorthand INFO log method
$logger->info('Log Message');

    // Using the shorthand DEBUG log method, with additional data
$logger->debug('Log Message', array('additional Data' => 'like in devLog'));

    // Shorthand with method chaining
t3lib_log_LogManager::getLogger(__CLASS__)->debug('Log Message');

    // Deprecation Log
t3lib_log_LogManager::getLogger('deprecated')->warning('Using t3lib_div::devLog() is deprecated. Use new Logging API instead!');

Workshop Abstract


See below file t3dd12-logging.pdf

Updated by Steffen Müller almost 10 years ago · 5 revisions