fix: [localTool:CommonConnector] Ensure one logger per connector

pull/85/head
Sami Mokaddem 2022-01-19 09:04:10 +01:00
parent 5eeda6b682
commit 20cc6017d0
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 18 additions and 15 deletions

View File

@ -24,21 +24,24 @@ class CommonConnectorTools
public function __construct() public function __construct()
{ {
Log::setConfig("LocalToolDebug", [ if (empty(Log::getConfig("LocalToolDebug{$this->connectorName}"))) {
'className' => FileLog::class, Log::setConfig("LocalToolDebug{$this->connectorName}", [
'path' => LOGS, 'className' => FileLog::class,
'file' => "{$this->connectorName}-debug", 'path' => LOGS,
'scopes' => [$this->connectorName], 'file' => "{$this->connectorName}-debug",
'levels' => ['notice', 'info', 'debug'], 'scopes' => [$this->connectorName],
]); 'levels' => ['notice', 'info', 'debug'],
Log::setConfig("LocalToolError", [ ]);
'className' => FileLog::class, }
'path' => LOGS, if (empty(Log::getConfig("LocalToolError{$this->connectorName}"))) {
'file' => "{$this->connectorName}-error", Log::setConfig("LocalToolError{$this->connectorName}", [
'scopes' => [$this->connectorName], 'className' => FileLog::class,
'levels' => ['warning', 'error', 'critical', 'alert', 'emergency'], 'path' => LOGS,
]); 'file' => "{$this->connectorName}-error",
'scopes' => [$this->connectorName],
'levels' => ['warning', 'error', 'critical', 'alert', 'emergency'],
]);
}
} }
protected function logDebug($message) protected function logDebug($message)