45 lines
1.7 KiB
Python
45 lines
1.7 KiB
Python
# -*- coding: utf-8 -*- vim:sw=4:sts=4:et:ai:si:sta:fenc=utf-8
|
|
|
|
__ebegin_params = {}
|
|
def ebegin(msg, level=None, params=__ebegin_params):
|
|
if not check_verbosity(level, V_INFO): return
|
|
params['status'] = 0
|
|
params['first'] = True
|
|
print_stdout('%s:' % msg, '* ', COLOR_WHITE, nl=None)
|
|
|
|
def edot(status=0, msg=None, warn=None, level=None, params=__ebegin_params):
|
|
# note: status est un exitcode (logique inversée)
|
|
if not check_verbosity(level, V_INFO): return
|
|
if not status and warn is not None:
|
|
status = 1
|
|
if not params.get('status', 0): params['status'] = status
|
|
if params.get('first', True):
|
|
print_stdout(' ', nl=None)
|
|
params['first'] = False
|
|
if display_debug():
|
|
if status:
|
|
if warn is not None:
|
|
print_stdout(warn and '(%s)' % warn or '', 'w', COLOR_YELLOW, before=warn and '\n ' or '', nl=None)
|
|
else:
|
|
print_stdout(msg and '(%s)' % msg or '', 'x', COLOR_RED, before=msg and '\n ' or '', nl=None)
|
|
else:
|
|
print_stdout(msg and '(%s)' % msg or '', '.', before=msg and '\n ' or '', nl=None)
|
|
else:
|
|
if status:
|
|
if warn is not None:
|
|
print_stdout('', 'w', COLOR_YELLOW, nl=None)
|
|
else:
|
|
print_stdout('', 'x', COLOR_RED, nl=None)
|
|
else:
|
|
print_stdout('.', nl=None)
|
|
|
|
def eend(status=None, level=None, params=__ebegin_params):
|
|
# note: status est un exitcode (logique inversée)
|
|
if not check_verbosity(level, V_INFO): return
|
|
if status is None: status = params.get('status', 0)
|
|
if not status:
|
|
print_stdout('', ' ok', COLOR_GREEN)
|
|
else:
|
|
print_stdout('', ' error', COLOR_RED)
|
|
return status
|