mirror of
https://github.com/beetbox/beets.git
synced 2026-01-06 16:02:53 +01:00
Remove the last from _ import * errors
This was a special case for our `logging` shim that is not truly necessary.
This commit is contained in:
parent
abc3dfbf42
commit
e88745833b
1 changed files with 11 additions and 7 deletions
|
|
@ -22,9 +22,9 @@ that when getLogger(name) instantiates a logger that logger uses
|
|||
|
||||
|
||||
from copy import copy
|
||||
from logging import * # noqa
|
||||
import subprocess
|
||||
import threading
|
||||
import logging
|
||||
|
||||
|
||||
def logsafe(val):
|
||||
|
|
@ -66,7 +66,7 @@ def logsafe(val):
|
|||
return val
|
||||
|
||||
|
||||
class StrFormatLogger(Logger):
|
||||
class StrFormatLogger(logging.Logger):
|
||||
"""A version of `Logger` that uses `str.format`-style formatting
|
||||
instead of %-style formatting.
|
||||
"""
|
||||
|
|
@ -88,13 +88,13 @@ class StrFormatLogger(Logger):
|
|||
return super()._log(level, m, (), exc_info, extra)
|
||||
|
||||
|
||||
class ThreadLocalLevelLogger(Logger):
|
||||
class ThreadLocalLevelLogger(logging.Logger):
|
||||
"""A version of `Logger` whose level is thread-local instead of shared.
|
||||
"""
|
||||
|
||||
def __init__(self, name, level=NOTSET):
|
||||
def __init__(self, name, level=logging.NOTSET):
|
||||
self._thread_level = threading.local()
|
||||
self.default_level = NOTSET
|
||||
self.default_level = logging.NOTSET
|
||||
super().__init__(name, level)
|
||||
|
||||
@property
|
||||
|
|
@ -121,12 +121,16 @@ class BeetsLogger(ThreadLocalLevelLogger, StrFormatLogger):
|
|||
pass
|
||||
|
||||
|
||||
my_manager = copy(Logger.manager)
|
||||
my_manager = copy(logging.Logger.manager)
|
||||
my_manager.loggerClass = BeetsLogger
|
||||
|
||||
|
||||
# Act like the stdlib logging module by re-exporting its namespace.
|
||||
from logging import * # noqa
|
||||
|
||||
# Override the `getLogger` to use our machinery.
|
||||
def getLogger(name=None): # noqa
|
||||
if name:
|
||||
return my_manager.getLogger(name)
|
||||
else:
|
||||
return Logger.root
|
||||
return logging.Logger.root
|
||||
|
|
|
|||
Loading…
Reference in a new issue