You can declare new Audit "Slot" to log custom signal.
In your bundle (AcmeBundle), create a Audit folder.
In this Audit folder, create a folder defining audit group, example: Foo
In this last folder, create a new class.
namespace AcmeBundle\Audit\Foo;
use Edgar\EzUIAudit\Audit\AbstractAudit;
use eZ\Publish\Core\SignalSlot\Signal;
class <YourAudit>Audit extends AbstractAudit
{
public function receive(Signal $signal)
{
if (!$signal instanceof <Signal\Class\Path>l
|| !$this->auditService->isConfigured(self::class)
) {
return;
}
$this->infos = [
'<key>' => $signal-><key>,
// ...
];
$this->auditService->log($this);
}
}
- : name your audit class as your signal
- <Signal\Class\Path>: your signal class path
- : signal information to be logged
in a Resources/config/audits.yml, add
services:
_defaults:
autowire: true
autoconfigure: true
public: false
AcmeBundle\Audit\Foo\<YourAudit>Audit:
tags:
- { name: ezpublish.api.slot, signal: <Your\Signal> }