Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move logging from root logger #272

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions entsoe/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

from .misc import year_blocks, day_blocks

logger = logging.getLogger(__name__)


def retry(func):
"""Catches connection errors, waits and retries"""
Expand Down Expand Up @@ -63,7 +65,7 @@ def documents_wrapper(*args, **kwargs):
frame = func(*args, offset=offset, **kwargs)
frames.append(frame)
except NoMatchingDataError:
logging.debug(f"NoMatchingDataError: for offset {offset}")
logger.debug(f"NoMatchingDataError: for offset {offset}")
break

if len(frames) == 0:
Expand Down Expand Up @@ -97,7 +99,7 @@ def year_wrapper(*args, start=None, end=None, **kwargs):
try:
frame = func(*args, start=_start, end=_end, **kwargs)
except NoMatchingDataError:
logging.debug(f"NoMatchingDataError: between {_start} and {_end}")
logger.debug(f"NoMatchingDataError: between {_start} and {_end}")
frame = None
frames.append(frame)

Expand Down
3 changes: 2 additions & 1 deletion entsoe/entsoe.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from .decorators import retry, paginated, year_limited, day_limited, documents_limited
import warnings

logger = logging.getLogger(__name__)
warnings.filterwarnings('ignore', category=XMLParsedAsHTMLWarning)

__title__ = "entsoe-py"
Expand Down Expand Up @@ -91,7 +92,7 @@ def _base_request(self, params: Dict, start: pd.Timestamp,
}
params.update(base_params)

logging.debug(f'Performing request to {URL} with params {params}')
logger.debug(f'Performing request to {URL} with params {params}')
response = self.session.get(url=URL, params=params,
proxies=self.proxies, timeout=self.timeout)
try:
Expand Down