Skip to content

Commit 1f9d5a5

Browse files
committed
allow setting the default log level
1 parent 1b86706 commit 1f9d5a5

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/CLI.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ abstract class CLI
3232
'emergency' => array('', Colors::C_LIGHTRED, STDERR),
3333
);
3434

35+
protected $logdefault = 'success';
36+
3537
/**
3638
* constructor
3739
*
@@ -92,7 +94,7 @@ public function run()
9294
);
9395
$this->options->registerOption(
9496
'loglevel',
95-
'Minimum level of messages to display. Default is success. ' .
97+
'Minimum level of messages to display. Default is ' . $this->logdefault . '. ' .
9698
'Valid levels are: debug, info, notice, success, warning, error, critical, alert, emergency.',
9799
null,
98100
'level'
@@ -109,7 +111,7 @@ public function run()
109111
echo $this->options->help();
110112
exit(0);
111113
}
112-
$level = $this->options->getOpt('loglevel', 'success');
114+
$level = $this->options->getOpt('loglevel', $this->logdefault);
113115
if (!isset($this->loglevel[$level])) $this->fatal('Unknown log level');
114116
foreach (array_keys($this->loglevel) as $l) {
115117
if ($l == $level) break;

0 commit comments

Comments
 (0)