N°4756 - Ease extensibility for CRUD operations : 🎨 refactor after code review with PG

This commit is contained in:
Eric Espie
2023-01-26 17:32:02 +01:00
parent 5844717980
commit 1e37370789
13 changed files with 175 additions and 113 deletions

View File

@@ -0,0 +1,45 @@
<?php
/*
* @copyright Copyright (C) 2010-2023 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\Service\Events;
use IssueLog;
use LogChannels;
use utils;
class EventServiceLog extends IssueLog
{
const CHANNEL_DEFAULT = LogChannels::EVENT_SERVICE;
/**
* @param $sMessage
* @param $sEvent
* @param $sources
*
* @return void
* @throws \ConfigException
* @throws \CoreException
*/
public static function DebugEvent($sMessage, $sEvent, $sources)
{
$oConfig = utils::GetConfig();
$aLogEvents = $oConfig->Get('event_service.debug.filter_events');
$aLogSources = $oConfig->Get('event_service.debug.filter_sources');
if (is_array($aLogEvents)) {
if (!in_array($sEvent, $aLogEvents)) {
return;
}
}
if (is_array($aLogSources)) {
if (!EventHelper::MatchEventSource($aLogSources, $sources)) {
return;
}
}
static::Debug($sMessage);
}
}