Files
pathfinder/app/main/lib/logging/AbstractChannelLog.php
Exodus4D a8edf39697 - new "logging" system for map/system/signature/connection changes, closed #271
- new map change log to Slack channel
- new "rally point" logging to Slack channel
- new "rally point" poke options (e.g. custom message), closed #295
- new log options for WebSocket installations
- added ship "mass" logging (backend only), #313
- added map logging to Slack, #326
- added "ESI error rate" limit detection
- added "Monolog" as new logging library (Composer dependency)
- added "Swiftmailer" as new eMail library (Composer dependency)
- added Support for Redis session hander (performance boost)
- improved character select panels (visible "online" status)
- improved "activity logging" (more DB columns added to check)
- improved eMail logging (HTML template support)
- improved "delete map" now become "inactive" for some days before delete
- improved character logout handling
- improved /setup page for DB bootstrap (new button for DB create if not exists)
- fixed broken ship tracking (ship name re-added)
- fixed broken ship tracking for multiple chars on different browser tabs
- fixed broken cursor coordinates, closed #518
- fixed null pointer "charactermodel.php->isActive():925" closed #529
- fixed broken "scroll offset", closed #533 closed #534
- Updated "validation" library JS v0.10.1 -> v0.11.9
- Updated ORM Mapper _Cortex_ v1.5.0-dev -> v1.5.0
- and many more....
2017-10-22 17:58:34 +02:00

87 lines
2.0 KiB
PHP

<?php
/**
* Created by PhpStorm.
* User: exodu
* Date: 04.08.2017
* Time: 22:13
*/
namespace Lib\Logging;
abstract class AbstractChannelLog extends AbstractLog {
/**
* @var array
*/
protected $channelData = [];
public function __construct(string $action, array $channelData){
parent::__construct($action);
$this->setChannelData($channelData);
// add log processor -> remove $channelData from log
$processorClearChannelData = function($record){
$record['context'] = array_diff_key($record['context'], $this->getChannelData());
return $record;
};
// init processorConfig. IMPORTANT: first processor gets executed at the end!
$this->processorConfig = ['clearChannelData' => $processorClearChannelData] + $this->processorConfig;
}
/**
* @param array $channelData
*/
protected function setChannelData(array $channelData){
$this->channelData = $channelData;
}
/**
* @return array
*/
public function getChannelData() : array{
return $this->channelData;
}
/**
* @return int
*/
public function getChannelId() : int{
return (int)$this->getChannelData()['channelId'];
}
/**
* @return string
*/
public function getChannelName() : string{
return (string)$this->getChannelData()['channelName'];
}
/**
* @return array
*/
public function getData() : array{
$data['main'] = parent::getData();
if(!empty($channelLogData = $this->getChannelData())){
$channelData['channel'] = $channelLogData;
$data = $channelData + $data;
}
return $data;
}
/**
* @return array
*/
public function getContext(): array{
$context = parent::getContext();
// add temp data (e.g. used for $message placeholder replacement
$context += $this->getChannelData();
return $context;
}
}