Skip to content

Commit 2fc9408

Browse files
committed
logging: use module names as logger names
This makes it possible to filter logs on a per-module basis.
1 parent 0fec858 commit 2fc9408

File tree

18 files changed

+27
-19
lines changed

18 files changed

+27
-19
lines changed

beets/autotag/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
]
5151

5252
# Global logger.
53-
log = logging.getLogger("beets")
53+
log = logging.getLogger(__name__)
5454

5555
# Metadata fields that are already hardcoded, or where the tag name changes.
5656
SPECIAL_FIELDS = {

beets/autotag/hooks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
from .distance import Distance
2727

28-
log = logging.getLogger("beets")
28+
log = logging.getLogger(__name__)
2929

3030
V = TypeVar("V")
3131

beets/autotag/match.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
from beets.library import Item
3737

3838
# Global logger.
39-
log = logging.getLogger("beets")
39+
log = logging.getLogger(__name__)
4040

4141

4242
# Recommendation enumeration.

beets/importer/session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
QUEUE_SIZE = 128
3434

3535
# Global logger.
36-
log = logging.getLogger("beets")
36+
log = logging.getLogger(__name__)
3737

3838

3939
class ImportAbortError(Exception):

beets/importer/stages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
from .session import ImportSession
3636

3737
# Global logger.
38-
log = logging.getLogger("beets")
38+
log = logging.getLogger(__name__)
3939

4040
# ---------------------------- Producer functions ---------------------------- #
4141
# Functions that are called first i.e. they generate import tasks

beets/importer/state.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929

3030
# Global logger.
31-
log = logging.getLogger("beets")
31+
log = logging.getLogger(__name__)
3232

3333

3434
@dataclass

beets/importer/tasks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
from .session import ImportSession
3838

3939
# Global logger.
40-
log = logging.getLogger("beets")
40+
log = logging.getLogger(__name__)
4141

4242

4343
SINGLE_ARTIST_THRESH = 0.25
@@ -62,7 +62,7 @@
6262
REIMPORT_FRESH_FIELDS_ITEM = list(REIMPORT_FRESH_FIELDS_ALBUM)
6363

6464
# Global logger.
65-
log = logging.getLogger("beets")
65+
log = logging.getLogger(__name__)
6666

6767

6868
class ImportAbortError(Exception):

beets/library/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
from ..dbcore.query import FieldQuery, FieldQueryType
3232
from .library import Library # noqa: F401
3333

34-
log = logging.getLogger("beets")
34+
log = logging.getLogger(__name__)
3535

3636

3737
class LibModel(dbcore.Model["Library"]):

beets/library/queries.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import beets
66
from beets import dbcore, logging, plugins
77

8-
log = logging.getLogger("beets")
8+
log = logging.getLogger(__name__)
99

1010

1111
# Special path format key.

beets/plugins.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
LASTFM_KEY = "2dc3914abf35f0d9c92d97d8f8e42b43"
7474

7575
# Global logger.
76-
log = logging.getLogger("beets")
76+
log = logging.getLogger(__name__)
7777

7878

7979
class PluginConflictError(Exception):

0 commit comments

Comments
 (0)