core (log): fixed double call to ansiColors
This commit is contained in:
parent
97d655682c
commit
93a73aec45
1 changed files with 3 additions and 7 deletions
|
|
@ -56,9 +56,8 @@ class ConfigureBasic(log.ConfigureBase):
|
|||
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 @@ class ConfigureTwisted(ConfigureBasic):
|
|||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue