diff --git a/CHANGELOG b/CHANGELOG index f32f3696e0..cdfbc155e2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Use number of verbose flag as log level * Add coroutine concurrency option * Add increasing delay on database operational error retry * Allows to lock records for update diff --git a/doc/topics/logs.rst b/doc/topics/logs.rst index 6c970e7628..bc3db0ddf5 100644 --- a/doc/topics/logs.rst +++ b/doc/topics/logs.rst @@ -5,8 +5,7 @@ Logging configuration ===================== Without any configuration, trytond writes ERROR messages to standard output. -With the verbose flag set, it writes INFO message. -And with the verbose and development flags set, it write DEBUG message. +For each verbose flag set, the log level decreases. Logs can be configured using a `configparser-format`_ file. The filename can be specified using trytond ``logconf`` parameter. diff --git a/trytond/commandline.py b/trytond/commandline.py index 64b3fbc34c..17d8595be5 100644 --- a/trytond/commandline.py +++ b/trytond/commandline.py @@ -20,8 +20,8 @@ def get_parser(): parser.add_argument("-c", "--config", dest="configfile", metavar='FILE', nargs='+', default=[os.environ.get('TRYTOND_CONFIG')], help='Specify configuration files') - parser.add_argument("-v", "--verbose", action="store_true", - dest="verbose", help="enable verbose mode") + parser.add_argument("-v", "--verbose", action='count', + dest="verbose", default=0, help="enable verbose mode") parser.add_argument('--dev', dest='dev', action='store_true', help='enable development mode') @@ -96,13 +96,7 @@ def config_log(options): else: logformat = ('%(process)s %(thread)s [%(asctime)s] ' '%(levelname)s %(name)s %(message)s') - if options.verbose: - if options.dev: - level = logging.DEBUG - else: - level = logging.INFO - else: - level = logging.ERROR + level = max(logging.ERROR - options.verbose * 10, logging.NOTSET) logging.basicConfig(level=level, format=logformat) logging.captureWarnings(True)