Menu

Log API

Frederic Minne

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
    • Parameters
      • string|array $message
  • static warning ( $message ) : Write a warning message in the console
    • Parameters
      • string|array $message
  • static error ( $message ) : Write an error message in the console
    • Parameters
      • string|array $message
  • static success ( $message ) : Write a success message in the console
    • Parameters
      • string|array $message
  • static info ( $message ) : Write an information message in the console
    • Parameters
      • string|array $message
  • static message ( $message ) : Write a message in the console
    • Parameters
      • string|array $message
  • 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 );

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.