mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
Code review: Fix code conventions
This commit is contained in:
@@ -656,9 +656,9 @@ abstract class LogAPI
|
||||
* @throws \ConfigException if log wrongly configured
|
||||
* @uses GetMinLogLevel
|
||||
*/
|
||||
final public static function IsLogLevelEnabled(string $sLevel, string $sChannel, string $code = 'log_level_min'): bool
|
||||
final public static function IsLogLevelEnabled(string $sLevel, string $sChannel, string $sCode = 'log_level_min'): bool
|
||||
{
|
||||
$sMinLogLevel = self::GetMinLogLevel($sChannel, $code);
|
||||
$sMinLogLevel = self::GetMinLogLevel($sChannel, $sCode);
|
||||
|
||||
if ($sMinLogLevel === false || $sMinLogLevel === 'false') {
|
||||
return false;
|
||||
@@ -678,6 +678,7 @@ abstract class LogAPI
|
||||
|
||||
/**
|
||||
* @param string $sChannel
|
||||
* @param string $sCode
|
||||
*
|
||||
* @return string one of the LEVEL_* const value : the one configured it if exists, otherwise default log level for this channel
|
||||
* Config can be set :
|
||||
@@ -697,14 +698,14 @@ abstract class LogAPI
|
||||
*
|
||||
* @link https://www.itophub.io/wiki/page?id=3_0_0%3Aadmin%3Alog iTop log reference
|
||||
*/
|
||||
protected static function GetMinLogLevel($sChannel, $code = 'log_level_min')
|
||||
protected static function GetMinLogLevel($sChannel, $sCode = 'log_level_min')
|
||||
{
|
||||
$oConfig = static::GetConfig();
|
||||
if (!$oConfig instanceof Config) {
|
||||
return static::GetLevelDefault();
|
||||
}
|
||||
|
||||
$sLogLevelMin = $oConfig->Get($code);
|
||||
$sLogLevelMin = $oConfig->Get($sCode);
|
||||
|
||||
if (empty($sLogLevelMin)) {
|
||||
return static::GetLevelDefault();
|
||||
@@ -1106,9 +1107,9 @@ class LogFileRotationProcess implements iScheduledProcess
|
||||
/**
|
||||
* Log exceptions using dedicated API and logic.
|
||||
*
|
||||
* Please use @see ExceptionLog::FromException() to log exceptions
|
||||
* Please use {@see ExceptionLog::FromException()} to log exceptions
|
||||
*
|
||||
* @Since 3.0.0
|
||||
* @since 3.0.0
|
||||
*/
|
||||
class ExceptionLog extends LogAPI
|
||||
{
|
||||
@@ -1134,10 +1135,11 @@ class ExceptionLog extends LogAPI
|
||||
$aContext['exception class'] = get_class($oException);
|
||||
}
|
||||
|
||||
return self::Log($sLevel, $oException->getMessage(), get_class($oException), $aContext);
|
||||
self::Log($sLevel, $oException->getMessage(), get_class($oException), $aContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws \ConfigException if log wrongly configured
|
||||
*/
|
||||
public static function Log($sLevel, $sMessage, $sClass = null, $aContext = array())
|
||||
@@ -1165,15 +1167,14 @@ class ExceptionLog extends LogAPI
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected static function FindClassChannel($sClass, $code = 'log_level_min')
|
||||
protected static function FindClassChannel($sClass, $sCode = 'log_level_min')
|
||||
{
|
||||
$oConfig = static::GetConfig();
|
||||
if (!$oConfig instanceof Config) {
|
||||
return static::GetLevelDefault();
|
||||
}
|
||||
|
||||
$sLogLevelMin = $oConfig->Get($code);
|
||||
$sLogLevelMin = $oConfig->Get($sCode);
|
||||
|
||||
if (empty($sLogLevelMin)) {
|
||||
return $sClass;
|
||||
@@ -1200,6 +1201,9 @@ class ExceptionLog extends LogAPI
|
||||
return $sClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public static function Enable($sTargetFile = null)
|
||||
{
|
||||
if (empty($sTargetFile))
|
||||
@@ -1238,9 +1242,9 @@ class ExceptionLog extends LogAPI
|
||||
}
|
||||
|
||||
/**
|
||||
* used by the tests
|
||||
* @internal Used by the tests
|
||||
*/
|
||||
private static function getLastEventIssue()
|
||||
private static function GetLastEventIssue()
|
||||
{
|
||||
return self::$oLastEventIssue;
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ class ExceptionLogTest extends ItopDataTestCase
|
||||
|
||||
ExceptionLog::FromException($oException, $aContext, $sLevel);
|
||||
|
||||
$oExpectedLastEventIssue = $this->InvokeNonPublicStaticMethod('ExceptionLog', 'getLastEventIssue', []);
|
||||
$oExpectedLastEventIssue = $this->InvokeNonPublicStaticMethod('ExceptionLog', 'GetLastEventIssue', []);
|
||||
|
||||
if (0 == $iExpectedDbWriteNumber) {
|
||||
$this->assertNull($oExpectedLastEventIssue);
|
||||
|
||||
Reference in New Issue
Block a user