forked from goodboy/tractor
1
0
Fork 0

Merge pull request #164 from goodboy/clean_log_header

Drop duplicate project-package name in msg header
pdb_madness
goodboy 2020-12-09 10:25:31 -05:00 committed by GitHub
commit e27dc2e244
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -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