app = $app;
if ($intern) {
return;
}
$this->logService = $app->Container->get('DatabaseLogService');
$this->configService = $app->Container->get('LoggerConfigService');
$this->request = $app->Container->get('Request');
$this->app->ActionHandlerInit($this);
$this->app->ActionHandler("list", "LogList");
$this->app->ActionHandler("settings", "LogSettings");
$this->app->ActionHandler("deleteall", "LogDeleteAll");
$this->app->ActionHandler("minidetail", "LogDumpMinidetail");
$this->app->DefaultActionHandler("list");
$this->app->ActionHandlerListen($app);
}
/**
* @param Application $app
* @param string $name
* @param array $erlaubtevars
*
* @return array
*/
public function TableSearch($app, $name, $erlaubtevars): array
{
switch ($name) {
case 'log':
$allowed['log'] = ['list'];
$heading = [
'',
'ID',
'Zeit',
'Level',
'Aufrufart',
'Aufruf',
'Klasse',
'Funktion',
'Zeile',
'Nachricht',
'',
];
$width = ['1%', '4%', '9%', '4%', '10%', '15%', '20%', '10%', '5%', '40%'];
$findcols = [
'open',
'l.id',
'l.log_time',
'l.level',
'l.origin_type',
'l.origin_detail',
'l.class',
'l.method',
'l.line',
'l.message',
'l.id',
];
$searchsql = [
'l.id',
'l.level',
'l.origin_type',
'l.origin_detail',
'l.class',
'l.method',
'l.line',
'l.message',
];
$defaultorder = 2;
$defaultorderdesc = 1;
$menucol = 1;
$moreinfo = true;
$menu = '';
// SQL statement
$sql = "SELECT l.id,
'' AS `open`,
l.id,
SUBSTRING(DATE_FORMAT(l.log_time,'%d.%m.%Y %H:%i:%s %f'),1,23) AS `log_time`,
l.level, l.origin_type, l.origin_detail, l.class, l.method, l.line, l.message, l.id
FROM `log` AS `l`";
$fastcount = 'SELECT COUNT(l.id) FROM `log` AS `l`';
break;
}
$erg = [];
foreach ($erlaubtevars as $k => $v) {
if (isset($$v)) {
$erg[$v] = $$v;
}
}
return $erg;
}
/**
* @return void
*/
public function LogDumpMinidetail(): void
{
if (!$this->app->Container->has('DatabaseLogGateway')) {
$response = new Xentral\Components\Http\Response('', 500);
$response->send();
$this->app->ExitXentral();
}
/** @var DatabaseLogGateway $gateway */
$gateway = $this->app->Container->get('DatabaseLogGateway');
$id = $this->request->get->getInt('id', 0);
if ($id < 1) {
$response = new Response('', 404);
$response->send();
$this->app->ExitXentral();
}
$dump = $gateway->tryGetLogDump($id);
if ($dump !== null) {
$dump = sprintf('
Dump:
%s