mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
[enh] Use logger in cli helper when MoulinetteError is raised
This commit is contained in:
parent
9f7dd9c7ad
commit
28db3c5d37
1 changed files with 2 additions and 3 deletions
|
@ -109,14 +109,13 @@ def cli(namespaces, args, print_json=False, print_plain=False, use_cache=True):
|
||||||
instead of using the cached one
|
instead of using the cached one
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from moulinette.interfaces.cli import colorize
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
moulinette = init_interface('cli',
|
moulinette = init_interface('cli',
|
||||||
actionsmap={'namespaces': namespaces,
|
actionsmap={'namespaces': namespaces,
|
||||||
'use_cache': use_cache})
|
'use_cache': use_cache})
|
||||||
moulinette.run(args, print_json, print_plain)
|
moulinette.run(args, print_json, print_plain)
|
||||||
except MoulinetteError as e:
|
except MoulinetteError as e:
|
||||||
print('%s %s' % (colorize(m18n.g('error'), 'red'), e.strerror))
|
import logging
|
||||||
|
logging.getLogger('yunohost').error(e.strerror)
|
||||||
return e.errno
|
return e.errno
|
||||||
return 0
|
return 0
|
||||||
|
|
Loading…
Add table
Reference in a new issue