diff --git a/src/python/jw/pkg/lib/log.py b/src/python/jw/pkg/lib/log.py index ee636f72..57f38b09 100644 --- a/src/python/jw/pkg/lib/log.py +++ b/src/python/jw/pkg/lib/log.py @@ -181,6 +181,8 @@ def log_m(prio: int, *args: Any, **kwargs: Any) -> None: # export if isinstance(a, list): margs += '\n'.join([str(elem) for elem in a]) continue + if a == '': + continue margs += ' ' + str(a) if 'caller' not in kwargs: caller = get_caller_pos(1) @@ -205,7 +207,7 @@ def log( # export color_off = '' if f_date in _flags: - msg += datetime.now().strftime("%b %d %H:%M:%S.%f ") + msg += datetime.now().strftime("%b %d %H:%M:%S.%f") + ' ' if f_prio in _flags: msg += _short_prio_str[prio] + ' ' @@ -227,8 +229,8 @@ def log( # export margs = '' if len(args): - for a in args: - margs += ' ' + str(a) + for i, a in enumerate(args): + margs += (' ' if (i or (msg and not msg.endswith(' '))) else '') + str(a) if only_printable: margs = _special_char_regex.sub( lambda mo: _special_chars[mo.string[mo.start():mo.end()]], margs