Skip to content

Commit 3016737

Browse files
chkoarglemaitre
authored andcommitted
[MRG] Fix logger name (#377)
1 parent 83165ba commit 3016737

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

imblearn/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def __getstate__(self):
119119

120120
def __setstate__(self, dict):
121121
"""Re-open the logger."""
122-
logger = logging.getLogger(__name__)
122+
logger = logging.getLogger(self.__module__)
123123
self.__dict__.update(dict)
124124
self.logger = logger
125125

@@ -133,7 +133,7 @@ class BaseSampler(SamplerMixin):
133133

134134
def __init__(self, ratio='auto'):
135135
self.ratio = ratio
136-
self.logger = logging.getLogger(__name__)
136+
self.logger = logging.getLogger(self.__module__)
137137

138138
def fit(self, X, y):
139139
"""Find the classes statistics before to perform sampling.

imblearn/tests/test_common.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# Authors: Guillaume Lemaitre <[email protected]>
33
# Christos Aridas
44
# License: MIT
5-
65
from sklearn.utils.testing import _named_check
76

87
from imblearn.utils.estimator_checks import check_estimator, _yield_all_checks
@@ -34,3 +33,7 @@ def test_non_meta_estimators():
3433
continue
3534
for check in _yield_all_checks(name, Estimator):
3635
yield _named_check(check, name), name, Estimator
36+
37+
logger_name = Estimator().logger.name
38+
class_module_name = Estimator.__module__
39+
assert logger_name == class_module_name

0 commit comments

Comments
 (0)