Commit fcc9708e authored by MERCIER Michael's avatar MERCIER Michael
Browse files

[core] enable logging verbosity selection

parent afb04cee
......@@ -709,11 +709,7 @@ class BatsimScheduler(object):
def __init__(self, options = {}):
self.options = options
FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
self.logger = logging.getLogger(__name__)
def onAfterBatsimInit(self):
# You now have access to and all other functions
......@@ -7,8 +7,9 @@ Usage:
--version Print the version of pybatsim and exit
-h --help Show this help message and exit.
-v --verbose Be verbose.
-d --debug Be more verbose.
-v --verbosity=<verbosity-level> Sets the verbosity level. Available
values are {debug, info, warning, error, critical}
Default: info
-p --protect Protect the scheduler using a validating machine.
-s --socket-endpoint=<endpoint> Batsim socket endpoint to use [default: tcp://*:28000]
-e --event-socket-endpoint=<endpoint> Socket endpoint to use to publish scheduler events
......@@ -30,10 +31,10 @@ def main():
arguments = docopt(__doc__, version=__version__)
loglevel = logging.WARNING
if arguments['--verbose']:
if not arguments['--verbosity']:
loglevel = logging.INFO
if arguments['--debug']:
loglevel = logging.DEBUG
loglevel = logging.getLevelName(arguments['--verbosity'].upper())
FORMAT = '[pybatsim - %(asctime)s - %(name)s - %(levelname)s] %(message)s'
logging.basicConfig(format=FORMAT, level=loglevel)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment