ExpressionEngine Docs

Logger Class

Calling the Logger Class

class Logger

Load the Logger library.

ee()->load->library('logger');

Developer Log

The control panel contains a developer log, which is a log for ExpressionEngine and its third-party developers to bring notices or warnings to the attention of the Super Admin.

Control Panel Location: Developer --> Logs --> Developer

For example, ExpressionEngine uses the developer log to warn developers if a core function that is planned to be deprecated is being used by any third-party add-ons.

developer($data[, $update = FALSE[, $expires = 0]])

Parameter Type Description
$data String Message to send to the developer log
$update Boolean TRUE if you want to update a previous message instead of creating a new one. This is good for situations where a notice does not need to be logged each time it’s triggered, but still needs the Super Admin’s attention.
$expires Integer Amount of time where you should only show one meessage. For example, if an item should only show once per week, an item is logged with an expires time of 604800 seconds.
Returns Array Array of data for the log message

To use the developer log to log your own events, notices or warnings that need to be brought to the attention of the Super Admin, call this method and pass the string of the notice:

ee()->logger->developer('Log message.');

Note: Be conscious of how often the developer() method is used so as not to clutter the developer log and run unnecessary queries.

log_action($action = '')

Write log message to the CP Log.

Parameter Type Description
$data String Message to send to the CP log

deprecate_template_tag($message, $regex, $replacement)

Replace deprecated template tag with the new one in site’s template and write message to the Developer Log.

Parameter Type Description
$message String Message to send to the Developer log
$regex String Regular expression that will match the old (deprecated) template tagthat will be run through preg_replace
$replacement String Replacement with the new template tag to pass to preg_replace