LogViewerEvent events
4 FeatherPanel plugin events on LogViewerEvent (2 emitted by the core): the event names, the arguments each listener gets, where they fire and a PHP listener for each.
Last synced from FeatherPanel 15b94e9 on .
On this page
Part of the plugin events reference. Listeners get the payload values as positional arguments in the order shown, cannot cancel the action, and must catch their own exceptions. 2 of these events are declared but no code emits them yet; they are marked not emitted.
Setup
Import LogViewerEvent in your entry class and register listeners in processEvents():
<?php
namespace App\Addons\myplugin;
use App\App;
use App\Plugins\AppPlugin;
use App\Plugins\PluginEvents;
use App\Plugins\Events\Events\LogViewerEvent;
class MyPlugin implements AppPlugin
{
public static function processEvents(PluginEvents $event): void
{
$event->on(LogViewerEvent::onLogCleared(), function ($logType, $logFile, $clearedBy): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:log_viewer:cleared ' . json_encode(['log_file' => $logFile]));
});
}
public static function pluginInstall(): void
{
}
public static function pluginUninstall(): void
{
}
}LogViewerEvent::onLogCleared()
Docblock: string log type, string file name. (the emitter passes 3 values, see the table)
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | log_type | $logType | not declared |
| 2 | log_file | $logFile | string |
| 3 | cleared_by | $clearedBy | not declared |
When it fires (1 site)
$event->on(LogViewerEvent::onLogCleared(), function ($logType, $logFile, $clearedBy): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:log_viewer:cleared ' . json_encode(['log_file' => $logFile]));
});LogViewerEvent::onLogViewerError()
Docblock: string error message, array context.
$event->on(LogViewerEvent::onLogViewerError(), function (...$args): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:log_viewer:error ' . json_encode($args));
});No code emits this event yet, so the arguments are unknown. The listener accepts any.
LogViewerEvent::onLogsUploaded()
Docblock: array upload results. (the emitter passes 2 values, see the table)
| # | Payload key | Listener parameter | Type |
|---|---|---|---|
| 1 | results | $results | not declared |
| 2 | uploaded_by | $uploadedBy | not declared |
When it fires (1 site)
$event->on(LogViewerEvent::onLogsUploaded(), function ($results, $uploadedBy): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:log_viewer:uploaded');
});LogViewerEvent::onLogViewed()
Docblock: string log type, string file name.
$event->on(LogViewerEvent::onLogViewed(), function (...$args): void {
App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:admin:log_viewer:viewed ' . json_encode($args));
});No code emits this event yet, so the arguments are unknown. The listener accepts any.