Mercurial > libervia-backend
changeset 2732:e55f871fa9db
core (log): fixed double call to ansiColors
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 27 Dec 2018 11:40:04 +0100 |
parents | a58e380c1c37 |
children | e347e32aa07f |
files | sat/core/log_config.py |
diffstat | 1 files changed, 3 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/sat/core/log_config.py Thu Dec 27 11:40:04 2018 +0100 +++ b/sat/core/log_config.py Thu Dec 27 11:40:04 2018 +0100 @@ -56,9 +56,8 @@ isatty = sys.stdout.isatty() except AttributeError: isatty = False - if ( - force_colors or isatty - ): # FIXME: isatty should be tested on each handler, not globaly + # FIXME: isatty should be tested on each handler, not globaly + if (force_colors or isatty): # we need colors log.Logger.post_treat = lambda logger, level, message: self.ansiColors( level, message @@ -123,11 +122,8 @@ can_colors and self.LOGGER_CLASS.colors ) or self.LOGGER_CLASS.force_colors: message = event.get("message", tuple()) - level = event.get("level", C.LOG_LVL_INFO) if message: - event["message"] = ( - self.ansiColors(level, "".join(message)), - ) # must be a tuple + event["message"] = ("".join(message),) # must be a tuple observer(event) # we can now call the original observer return observer_hook