- BC Break: Core _PHP_ framework + dependencies moved into `composer.json` and are no longer part of this repo - Upgraded some 3rd party _Composer_ dependencies: `monolog/monolog`, `swiftmailer/swiftmailer`, `league/html-to-markdown`, `react/socket`, `react/promise-stream` - Fixed a bug where `/setup` throws HTTP `5xx` error if no `pathfinder` DB exists - Fixed compatibility issue with PHP `v7.4`, closed #887
55 lines
1.2 KiB
PHP
55 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: Exodus 4D
|
|
* Date: 23.02.2019
|
|
* Time: 19:11
|
|
*/
|
|
|
|
namespace lib\logging\handler;
|
|
|
|
|
|
use Monolog\Logger;
|
|
|
|
class SocketHandler extends \Monolog\Handler\SocketHandler {
|
|
|
|
/**
|
|
* some meta data (additional processing information)
|
|
* @var array|string
|
|
*/
|
|
protected $metaData = [];
|
|
|
|
public function __construct($connectionString, $level = Logger::DEBUG, $bubble = true, $metaData = []){
|
|
$this->metaData = $metaData;
|
|
|
|
parent::__construct($connectionString, $level, $bubble);
|
|
}
|
|
|
|
/**
|
|
* overwrite default handle()
|
|
* -> change data structure after processor() calls and before formatter() calls
|
|
* @param array $record
|
|
* @return bool
|
|
*/
|
|
public function handle(array $record) : bool {
|
|
if (!$this->isHandling($record)) {
|
|
return false;
|
|
}
|
|
|
|
$record = $this->processRecord($record);
|
|
|
|
$record = [
|
|
'task' => 'logData',
|
|
'load' => [
|
|
'meta' => $this->metaData,
|
|
'log' => $record
|
|
]
|
|
];
|
|
|
|
$record['formatted'] = $this->getFormatter()->format($record);
|
|
|
|
$this->write($record);
|
|
|
|
return false === $this->bubble;
|
|
}
|
|
} |