Attention une mise à jour du service Gitlab va être effectuée le mardi 14 décembre entre 13h30 et 14h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes.

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