add --debug parameter for froxlor_master_cronjob, thx to nachtgeist for the idea

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2016-02-16 10:07:02 +01:00
parent 5109443346
commit f65af0067d
3 changed files with 57 additions and 3 deletions

View File

@@ -125,6 +125,9 @@ class FileLogger extends AbstractLogger {
case LOG_CRIT:
$_type = 'critical';
break;
case LOG_DEBUG:
$_type = 'debug';
break;
default:
$_type = 'unknown';
break;

View File

@@ -40,6 +40,12 @@ class FroxlorLogger {
*/
static private $loggers = null;
/**
* whether to output log-messages to STDOUT (cron)
* @var bool
*/
static private $crondebug_flag = false;
/**
* Class constructor.
*
@@ -98,6 +104,33 @@ class FroxlorLogger {
return;
}
if (self::$crondebug_flag) {
switch($type) {
case LOG_INFO:
$_type = 'information';
break;
case LOG_NOTICE:
$_type = 'notice';
break;
case LOG_WARNING:
$_type = 'warning';
break;
case LOG_ERR:
$_type = 'error';
break;
case LOG_CRIT:
$_type = 'critical';
break;
case LOG_DEBUG:
$_type = 'debug';
break;
default:
$_type = 'unknown';
break;
}
echo "[".$_type."] ".$text.PHP_EOL;
}
if (Settings::Get('logger.log_cron') == '0'
&& $action == CRON_ACTION
) {
@@ -166,4 +199,15 @@ class FroxlorLogger {
Settings::Set('logger.log_cron', $_cronlog);
return true;
}
/**
* setter for crondebug-flag
*
* @param bool $_flag
*
* @return void
*/
public function setCronDebugFlag($_flag = false) {
self::$crondebug_flag = (bool)$_flag;
}
}