addLogEntry
Details
This page shows version 4.x. The current version can be found here.
The addLogEntry hook is triggered when a new log entry is added. It passes
the message, the function and the action as arguments and does not expect
a return value.
Note
Using the addLogEntry hook has been deprecated and will no longer work in Contao 5.0.
Parameters
string
$messageThe log message.
string
$funcThe PHP source method. Be aware that this is not necessarily a real function, the function accepts any string!
string
$actionThe log action. Usually one of the following constants, but can be any string.
TL_ERRORTL_ACCESSTL_GENERALTL_FILESTL_CRONTL_FORMSTL_CONFIGURATIONTL_NEWSLETTERTL_REPOSITORY
Example
// src/EventListener/AddLogEntryListener.php
namespace App\EventListener;
use Contao\CoreBundle\DependencyInjection\Attribute\AsHook;
#[AsHook('addLogEntry')]
class AddLogEntryListener
{
public function __invoke(string $message, string $func, string $action): void
{
// Do something …
}
}