From e637d9d23df4dda8a5ef0d46fdf82981208c53a0 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 3 Nov 2020 12:15:49 -0500 Subject: [PATCH] Drop duplicate project-package name in msg header --- tractor/log.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tractor/log.py b/tractor/log.py index 2f04c7b..ecee017 100644 --- a/tractor/log.py +++ b/tractor/log.py @@ -55,7 +55,15 @@ def get_logger( '''Return the package log or a sub-log for `name` if provided. ''' log = rlog = logging.getLogger(_root_name) + if name and name != _proj_name: + + # handling for modules that use ``get_logger(__name__)`` to + # avoid duplicate project-package token in msg output + rname, _, tail = name.partition('.') + if rname == _root_name: + name = tail + log = rlog.getChild(name) log.level = rlog.level