56 lines
1.1 KiB
PHP
56 lines
1.1 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace alveolata\log;
|
||
|
|
||
|
// require_once(DIR_ALVEOLATA . '/definitions.php');
|
||
|
require_once(DIR_ALVEOLATA . '/string/functions.php');
|
||
|
require_once(DIR_ALVEOLATA . '/json/functions.php');
|
||
|
require_once(DIR_ALVEOLATA . '/report/functions.php');
|
||
|
require_once(DIR_ALVEOLATA . '/log/output-interface.php');
|
||
|
|
||
|
|
||
|
/**
|
||
|
* @author Christian Fraß <frass@greenscale.de>
|
||
|
*/
|
||
|
class implementation_console implements interface_output
|
||
|
{
|
||
|
|
||
|
/**
|
||
|
* @param int $level_threshold
|
||
|
* @author Christian Fraß <frass@greenscale.de>
|
||
|
*/
|
||
|
public function __construct(
|
||
|
)
|
||
|
{
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
* @implementation
|
||
|
* @author Christian Fraß <frass@greenscale.de>
|
||
|
*/
|
||
|
public function process(
|
||
|
int $level,
|
||
|
\alveolata\report\struct_report $report
|
||
|
) : void
|
||
|
{
|
||
|
$message = \alveolata\string\coin(
|
||
|
(
|
||
|
empty($report->details)
|
||
|
? '<{{datetime}}> [{{level}}] {{incident}}'
|
||
|
: '<{{datetime}}> [{{level}}] {{incident}} | {{details}}'
|
||
|
),
|
||
|
[
|
||
|
'datetime' => date('Y-m-d|H:i:s', $report->timestamp),
|
||
|
'level' => output_translate_level($level),
|
||
|
'incident' => $report->incident,
|
||
|
'details' => \alveolata\json\encode($report->details),
|
||
|
]
|
||
|
);
|
||
|
error_log($message);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
?>
|