config: add --console-stderr parameter
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
da63f533be
commit
135a742b6e
1 changed files with 7 additions and 1 deletions
|
@ -817,6 +817,10 @@ class Config: # pylint: disable=too-many-instance-attributes
|
||||||
BooleanOption, 'enabled', default=False,
|
BooleanOption, 'enabled', default=False,
|
||||||
arg='--console', short_arg='-C',
|
arg='--console', short_arg='-C',
|
||||||
comment='Enable/disable console log')
|
comment='Enable/disable console log')
|
||||||
|
section.add_option(
|
||||||
|
BooleanOption, 'force_stderr', default=False,
|
||||||
|
arg='--console-stderr',
|
||||||
|
comment='Force console log on stderr')
|
||||||
section.add_option(
|
section.add_option(
|
||||||
StringOption, 'log_format', default=DEFAULT_CONSOLE_LOG_FORMAT,
|
StringOption, 'log_format', default=DEFAULT_CONSOLE_LOG_FORMAT,
|
||||||
arg='--console-log-format', comment='Console log format')
|
arg='--console-log-format', comment='Console log format')
|
||||||
|
@ -879,7 +883,9 @@ class Config: # pylint: disable=too-many-instance-attributes
|
||||||
logging.getLogger().setLevel(logging.INFO)
|
logging.getLogger().setLevel(logging.INFO)
|
||||||
|
|
||||||
if self.get('console', 'enabled'):
|
if self.get('console', 'enabled'):
|
||||||
stdout_console_handler = logging.StreamHandler(sys.stdout)
|
stdout_console_handler = logging.StreamHandler(
|
||||||
|
sys.stderr if self.get('console', 'force_stderr')
|
||||||
|
else sys.stdout)
|
||||||
stdout_console_handler.addFilter(StdoutInfoFilter())
|
stdout_console_handler.addFilter(StdoutInfoFilter())
|
||||||
stdout_console_handler.setLevel(logging.DEBUG)
|
stdout_console_handler.setLevel(logging.DEBUG)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue