Skip to content

Commit 3d80455

Browse files
committed
Fix wrong logger creation
Loggers need to be created using logging.getLogger() instead of logging.Logger(), otherwise they don't go through the configuration system, and they can't be controlled in tests for example. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent 8e7a7c8 commit 3d80455

File tree

10 files changed

+10
-10
lines changed

10 files changed

+10
-10
lines changed

src/frequenz/sdk/_data_handling/time_series.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
Key = TypeVar("Key")
1616
Value = TypeVar("Value")
1717

18-
logger = logging.Logger(__name__)
18+
logger = logging.getLogger(__name__)
1919

2020
SYMBOL_SEGMENT_SEPARATOR = "_"
2121

src/frequenz/sdk/_data_ingestion/component_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from ..microgrid import ComponentGraph
1111
from ..microgrid.component import ComponentCategory
1212

13-
logger = logging.Logger(__name__)
13+
logger = logging.getLogger(__name__)
1414

1515

1616
@dataclass

src/frequenz/sdk/_data_ingestion/formula_calculator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
METRIC_PV_PROD,
3737
)
3838

39-
logger = logging.Logger(__name__)
39+
logger = logging.getLogger(__name__)
4040

4141

4242
@dataclass(frozen=True)

src/frequenz/sdk/_data_ingestion/load_historic_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import pyarrow.parquet as pq
2323
from tqdm import tqdm
2424

25-
logger = logging.Logger(__name__)
25+
logger = logging.getLogger(__name__)
2626

2727
# directory path to all component data of a particular site
2828
HISTDATA_DIR = "/data"

src/frequenz/sdk/_data_ingestion/microgrid_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from .formula_calculator import FormulaCalculator
2828
from .gen_component_receivers import gen_component_receivers
2929

30-
logger = logging.Logger(__name__)
30+
logger = logging.getLogger(__name__)
3131

3232
CONFIG_FILE_FORMULA_PREFIX = "formula_"
3333

src/frequenz/sdk/actor/_decorator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import logging
1515
from typing import Any, Generic, Optional, Type, TypeVar
1616

17-
logger = logging.Logger(__name__)
17+
logger = logging.getLogger(__name__)
1818

1919
OT = TypeVar("OT")
2020

src/frequenz/sdk/actor/_resampling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from ._data_sourcing import ComponentMetricRequest
2020
from ._decorator import actor
2121

22-
logger = logging.Logger(__name__)
22+
logger = logging.getLogger(__name__)
2323

2424

2525
@actor

src/frequenz/sdk/microgrid/client/_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
EVChargerData,
4545
)
4646

47-
logger = logging.Logger(__name__)
47+
logger = logging.getLogger(__name__)
4848

4949

5050
class MicrogridApiClient(ABC):

src/frequenz/sdk/timeseries/_resampling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from ..util.asyncio import cancel_and_await
2121
from . import Sample
2222

23-
_logger = logging.Logger(__name__)
23+
_logger = logging.getLogger(__name__)
2424

2525

2626
DEFAULT_BUFFER_LEN_INIT = 16

src/frequenz/sdk/timeseries/logical_meter/_logical_meter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
)
2626
from ._resampled_formula_builder import ResampledFormulaBuilder
2727

28-
logger = logging.Logger(__name__)
28+
logger = logging.getLogger(__name__)
2929

3030

3131
class LogicalMeter:

0 commit comments

Comments
 (0)