How to log messages in Claroline 1.12
The prefered way : use the Console API
The Console class available in core/console.lib.php is the best way to log a message in Claroline since Claroline 1.9.
- static debug ( $message ) : Write a debug message in the console
- static warning ( $message ) : Write a warning message in the console
- static error ( $message ) : Write an error message in the console
- static success ( $message ) : Write a success message in the console
- static info ( $message ) : Write an information message in the console
- static message ( $message ) : Write a message in the console
- static log ( $message, $type ) : Generic log function
- Parameters
- string|array $message
- string $type
Usage :
Console::debug( "My debug message" );
The type of message logged in the database is controled by a configuration variable in the main settings to avoid to log too much messages on a production platform.
Use the Claroline Logger (since Claroline 1.12.0)
This method is not recommended.
Usage :
$GLOBALS['claroline']['logger']->log( $message, $type );