mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-19 07:12:26 +02:00
Cron parallelization * better logs
This commit is contained in:
@@ -7,10 +7,13 @@
|
||||
namespace Combodo\iTop\Service\Cron;
|
||||
|
||||
use LogAPI;
|
||||
use Page;
|
||||
|
||||
class CronLog extends LogAPI
|
||||
{
|
||||
public static $iProcessNumber = 0;
|
||||
private static $bDebug = false;
|
||||
private static $oP = null;
|
||||
|
||||
const CHANNEL_DEFAULT = 'Cron';
|
||||
/**
|
||||
@@ -27,4 +30,18 @@ class CronLog extends LogAPI
|
||||
$sMessage = 'cron'.str_pad(static::$iProcessNumber, 3).$sMessage;
|
||||
parent::Log($sLevel, $sMessage, $sChannel, $aContext);
|
||||
}
|
||||
|
||||
public static function Debug($sMessage, $sChannel = null, $aContext = array())
|
||||
{
|
||||
if (self::$bDebug && self::$oP) {
|
||||
self::$oP->p('cron'.str_pad(static::$iProcessNumber, 3).$sMessage);
|
||||
}
|
||||
parent::Debug($sMessage, $sChannel, $aContext);
|
||||
}
|
||||
|
||||
public static function SetDebug(Page $oP, $bDebug)
|
||||
{
|
||||
self::$oP = $oP;
|
||||
self::$bDebug = $bDebug;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user