Prev 2.3. Core Modules & their Functions, Environment Variables Next

2.3.4. Logging events with the vmLogger object

VirtueMart allows logging events that occur during the execution of the script. The global variable $vmLogger, which is used for logging purposes is an object of the class Log_display. This class is a child class of the Log class, which is a PEAR extension.

Note

You must declare

global $vmLogger;
to be able to use this variable inside of a function.

"Logging" means to log a message to display them to the user. While a function is executed (because its execution was triggered by the variable $func) in the file virtuemart_parser.php, the events are buffered. When the function call has ended, the contents of the log are flushed and all messages are displayed to the user in the order they were added to the log: first in, first out.

After that implicit flushing is enabled - what means that you can log a message and it is printed into the HTML code where you call the log function.

Currently the Log_display class used by VM offers 9 log levels:

Please note that Debug log entries are only shown to the user, when DEBUG is enabled by configuration.

To log an event, you can use a special function for each log level: