Skip to content

Commit 87aaafd

Browse files
committed
improve(quality): use plugin logger instead of root logging
1 parent 2a3e999 commit 87aaafd

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

mkdocs_rss_plugin/util.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
# ##################################
66

77
# standard library
8-
import logging
98
from collections.abc import Iterable
109
from datetime import date, datetime
1110
from functools import lru_cache
@@ -294,20 +293,20 @@ def get_file_dates(
294293
format="%at",
295294
)
296295
except GitCommandError as err:
297-
logging.warning(
296+
logger.info(
298297
f"Unable to read git logs of '{in_page.file.abs_src_path}'. "
299298
"Is git log readable? Falling back to build date. "
300299
"To disable this warning, set 'use_git: false' in plugin options. "
301300
f"Trace: {err}"
302301
)
303302
except GitCommandNotFound as err:
304-
logging.error(
303+
logger.warning(
305304
"Unable to perform command 'git log'. Is git installed? "
306305
"Falling back to build date. "
307306
"To disable this warning, set 'use_git: false' in plugin options. "
308307
f"Trace: {err}"
309308
)
310-
self.git_is_valid = 0
309+
self.git_is_valid = False
311310
# convert timestamps into datetimes
312311
if isinstance(dt_created, (str, float, int)) and dt_created:
313312
dt_created = set_datetime_zoneinfo(
@@ -374,7 +373,7 @@ def get_authors_from_meta(self, in_page: Page) -> Optional[tuple[str]]:
374373
elif isinstance(in_page.meta.get("author"), (list, tuple)):
375374
return tuple(in_page.meta.get("author"))
376375
else:
377-
logging.warning(
376+
logger.warning(
378377
"Type of author value in page.meta "
379378
f"({in_page.file.abs_src_path}) is not valid. "
380379
"It should be str, list or tuple, "
@@ -396,7 +395,7 @@ def get_authors_from_meta(self, in_page: Page) -> Optional[tuple[str]]:
396395
else:
397396
return tuple(in_page.meta.get("authors"))
398397
else:
399-
logging.warning(
398+
logger.warning(
400399
"Type of authors value in page.meta (%s) is not valid. "
401400
"It should be str, list or tuple, not: %s."
402401
% in_page.file.abs_src_path,

0 commit comments

Comments
 (0)