[fix] Use given namespace in cli/api helpers for logging

This commit is contained in:
Jérôme Lebleu 2015-12-17 21:43:43 +01:00
parent 87f171f25b
commit cbc64af4a5

View file

@ -101,11 +101,11 @@ def api(namespaces, host='localhost', port=80, routes={},
moulinette.run(host, port) moulinette.run(host, port)
except MoulinetteError as e: except MoulinetteError as e:
import logging import logging
logging.getLogger('moulinette').error(e.strerror) logging.getLogger(namespaces[0]).error(e.strerror)
return e.errno return e.errno
except KeyboardInterrupt: except KeyboardInterrupt:
import logging import logging
logging.getLogger('moulinette').info(m18n.g('operation_interrupted')) logging.getLogger(namespaces[0]).info(m18n.g('operation_interrupted'))
return 0 return 0
def cli(namespaces, args, use_cache=True, output_as=None, parser_kwargs={}): def cli(namespaces, args, use_cache=True, output_as=None, parser_kwargs={}):
@ -136,6 +136,6 @@ def cli(namespaces, args, use_cache=True, output_as=None, parser_kwargs={}):
moulinette.run(args, output_as=output_as) moulinette.run(args, output_as=output_as)
except MoulinetteError as e: except MoulinetteError as e:
import logging import logging
logging.getLogger('moulinette').error(e.strerror) logging.getLogger(namespaces[0]).error(e.strerror)
return e.errno return e.errno
return 0 return 0