CLI tools: fix --quiet not working if --log is unset
This commit is contained in:
parent
523e1cb9e8
commit
8d190d539b
|
@ -1,5 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
class Debug {
|
class Debug {
|
||||||
|
public static $LOG_DISABLED = -1;
|
||||||
public static $LOG_NORMAL = 0;
|
public static $LOG_NORMAL = 0;
|
||||||
public static $LOG_VERBOSE = 1;
|
public static $LOG_VERBOSE = 1;
|
||||||
public static $LOG_EXTENDED = 2;
|
public static $LOG_EXTENDED = 2;
|
||||||
|
@ -9,7 +10,7 @@ class Debug {
|
||||||
private static $logfile = false;
|
private static $logfile = false;
|
||||||
private static $loglevel = 0;
|
private static $loglevel = 0;
|
||||||
|
|
||||||
public static function set_logfile($logfile) {
|
public static function set_logfile($logfile) {
|
||||||
Debug::$logfile = $logfile;
|
Debug::$logfile = $logfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -117,7 +117,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug::set_enabled(true);
|
Debug::set_enabled(true);
|
||||||
Debug::set_quiet(isset($options['quiet']));
|
|
||||||
|
|
||||||
if (isset($options["log-level"])) {
|
if (isset($options["log-level"])) {
|
||||||
Debug::set_loglevel((int)$options["log-level"]);
|
Debug::set_loglevel((int)$options["log-level"]);
|
||||||
|
@ -126,6 +125,11 @@
|
||||||
if (isset($options["log"])) {
|
if (isset($options["log"])) {
|
||||||
Debug::set_logfile($options["log"]);
|
Debug::set_logfile($options["log"]);
|
||||||
Debug::log("Logging to " . $options["log"]);
|
Debug::log("Logging to " . $options["log"]);
|
||||||
|
Debug::set_quiet(isset($options['quiet']));
|
||||||
|
} else {
|
||||||
|
if (isset($options['quiet'])) {
|
||||||
|
Debug::set_loglevel(Debug::$LOG_DISABLED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($options["daemon"])) {
|
if (!isset($options["daemon"])) {
|
||||||
|
|
|
@ -153,7 +153,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug::set_enabled(true);
|
Debug::set_enabled(true);
|
||||||
Debug::set_quiet(isset($options['quiet']));
|
|
||||||
|
|
||||||
if (isset($options["log-level"])) {
|
if (isset($options["log-level"])) {
|
||||||
Debug::set_loglevel((int)$options["log-level"]);
|
Debug::set_loglevel((int)$options["log-level"]);
|
||||||
|
@ -162,6 +161,11 @@
|
||||||
if (isset($options["log"])) {
|
if (isset($options["log"])) {
|
||||||
Debug::set_logfile($options["log"]);
|
Debug::set_logfile($options["log"]);
|
||||||
Debug::log("Logging to " . $options["log"]);
|
Debug::log("Logging to " . $options["log"]);
|
||||||
|
Debug::set_quiet(isset($options['quiet']));
|
||||||
|
} else {
|
||||||
|
if (isset($options['quiet'])) {
|
||||||
|
Debug::set_loglevel(Debug::$LOG_DISABLED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($options["tasks"])) {
|
if (isset($options["tasks"])) {
|
||||||
|
|
Loading…
Reference in New Issue