View .md

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()

Name: featherpanel:admin:log_viewer:clearedemitted at 1 siteCancel or modify: nodefinition

Docblock: string log type, string file name. (the emitter passes 3 values, see the table)

#Payload keyListener parameterType
1log_type$logTypenot declared
2log_file$logFilestring
3cleared_by$clearedBynot 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()

Name: featherpanel:admin:log_viewer:errornot emittedCancel or modify: nodefinition

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()

Name: featherpanel:admin:log_viewer:uploadedemitted at 1 siteCancel or modify: nodefinition

Docblock: array upload results. (the emitter passes 2 values, see the table)

#Payload keyListener parameterType
1results$resultsnot declared
2uploaded_by$uploadedBynot 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()

Name: featherpanel:admin:log_viewer:viewednot emittedCancel or modify: nodefinition

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.