mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Set verbose by default (and remove the corresponding option)
This commit is contained in:
parent
91483f3896
commit
e47fc937c3
1 changed files with 6 additions and 12 deletions
18
bin/yunohost
18
bin/yunohost
|
@ -9,8 +9,8 @@ import argparse
|
||||||
IN_DEVEL = False
|
IN_DEVEL = False
|
||||||
|
|
||||||
# Level for which loggers will log
|
# Level for which loggers will log
|
||||||
LOGGERS_LEVEL = 'INFO'
|
LOGGERS_LEVEL = 'DEBUG'
|
||||||
TTY_LOG_LEVEL = 'SUCCESS'
|
TTY_LOG_LEVEL = 'INFO'
|
||||||
|
|
||||||
# Handlers that will be used by loggers
|
# Handlers that will be used by loggers
|
||||||
# - file: log to the file LOG_DIR/LOG_FILE
|
# - file: log to the file LOG_DIR/LOG_FILE
|
||||||
|
@ -58,10 +58,6 @@ def _parse_cli_args():
|
||||||
action='store_true', default=False,
|
action='store_true', default=False,
|
||||||
help="Log and print debug messages",
|
help="Log and print debug messages",
|
||||||
)
|
)
|
||||||
parser.add_argument('--verbose',
|
|
||||||
action='store_true', default=False,
|
|
||||||
help="Be more verbose in the output",
|
|
||||||
)
|
|
||||||
parser.add_argument('--quiet',
|
parser.add_argument('--quiet',
|
||||||
action='store_true', default=False,
|
action='store_true', default=False,
|
||||||
help="Don't produce any output",
|
help="Don't produce any output",
|
||||||
|
@ -92,13 +88,13 @@ def _parse_cli_args():
|
||||||
|
|
||||||
return (parser, opts, args)
|
return (parser, opts, args)
|
||||||
|
|
||||||
def _init_moulinette(debug=False, verbose=False, quiet=False):
|
def _init_moulinette(debug=False, quiet=False):
|
||||||
"""Configure logging and initialize the moulinette"""
|
"""Configure logging and initialize the moulinette"""
|
||||||
# Define loggers handlers
|
# Define loggers handlers
|
||||||
handlers = set(LOGGERS_HANDLERS)
|
handlers = set(LOGGERS_HANDLERS)
|
||||||
if quiet and 'tty' in handlers:
|
if quiet and 'tty' in handlers:
|
||||||
handlers.remove('tty')
|
handlers.remove('tty')
|
||||||
elif verbose and 'tty' not in handlers:
|
elif 'tty' not in handlers:
|
||||||
handlers.append('tty')
|
handlers.append('tty')
|
||||||
|
|
||||||
root_handlers = set(handlers)
|
root_handlers = set(handlers)
|
||||||
|
@ -108,10 +104,8 @@ def _init_moulinette(debug=False, verbose=False, quiet=False):
|
||||||
# Define loggers level
|
# Define loggers level
|
||||||
level = LOGGERS_LEVEL
|
level = LOGGERS_LEVEL
|
||||||
tty_level = TTY_LOG_LEVEL
|
tty_level = TTY_LOG_LEVEL
|
||||||
if verbose:
|
|
||||||
tty_level = 'INFO'
|
|
||||||
if debug:
|
if debug:
|
||||||
tty_level = level = 'DEBUG'
|
tty_level = 'DEBUG'
|
||||||
|
|
||||||
# Custom logging configuration
|
# Custom logging configuration
|
||||||
logging = {
|
logging = {
|
||||||
|
@ -196,7 +190,7 @@ if __name__ == '__main__':
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
parser, opts, args = _parse_cli_args()
|
parser, opts, args = _parse_cli_args()
|
||||||
_init_moulinette(opts.debug, opts.verbose, opts.quiet)
|
_init_moulinette(opts.debug, opts.quiet)
|
||||||
|
|
||||||
# Check that YunoHost is installed
|
# Check that YunoHost is installed
|
||||||
if not os.path.isfile('/etc/yunohost/installed') and \
|
if not os.path.isfile('/etc/yunohost/installed') and \
|
||||||
|
|
Loading…
Add table
Reference in a new issue