update logging to conform to ISO 8601
All checks were successful
ci/woodpecker/push/tests Pipeline was successful

This commit is contained in:
Ivan Schaller 2022-10-06 21:26:04 +02:00
parent ba3f0dfc9b
commit 1034532ad6
3 changed files with 7 additions and 5 deletions

View file

@ -91,7 +91,7 @@ test_autoflake:
@python3 -m autoflake --check --remove-all-unused-imports -r -v mangadlp/ @python3 -m autoflake --check --remove-all-unused-imports -r -v mangadlp/
test_pylama: test_pylama:
@python3 -m pylama mangadlp/ @python3 -m pylama --options tox.ini mangadlp/
test_pylint: test_pylint:
@python3 -m pylint --fail-under 9 mangadlp/ @python3 -m pylint --fail-under 9 mangadlp/

View file

@ -269,7 +269,7 @@ class MangaDLP:
# check if chapter already exists # check if chapter already exists
# check for folder, if file format is an empty string # check for folder, if file format is an empty string
if chapter_archive_path.exists(): if chapter_archive_path.exists():
log.warning(f"'{chapter_archive_path}' already exists. Skipping") log.info(f"'{chapter_archive_path}' already exists. Skipping")
self.hook.run( self.hook.run(
"chapter_pre", {"status": "skipped", "reason": "Existing"}, {} "chapter_pre", {"status": "skipped", "reason": "Existing"}, {}

View file

@ -1,11 +1,13 @@
import logging import logging
DATE_FMT = "%Y-%m-%dT%H:%M:%S%z"
# prepare custom levels and default config of logger # prepare custom levels and default config of logger
def prepare_logger(): def prepare_logger():
logging.basicConfig( logging.basicConfig(
format="%(asctime)s | [%(levelname)s] [%(name)s]: %(message)s", format="%(asctime)s | [%(levelname)s] [%(name)s]: %(message)s",
datefmt="%Y-%m-%d %H:%M:%S", datefmt=DATE_FMT,
level=20, level=20,
handlers=[logging.StreamHandler()], handlers=[logging.StreamHandler()],
) )
@ -21,13 +23,13 @@ def format_logger(verbosity: int):
if verbosity >= 20: if verbosity >= 20:
logging.basicConfig( logging.basicConfig(
format="%(asctime)s | %(message)s", format="%(asctime)s | %(message)s",
datefmt="%Y-%m-%d %H:%M:%S", datefmt=DATE_FMT,
force=True, force=True,
) )
else: else:
logging.basicConfig( logging.basicConfig(
format="%(asctime)s | [%(levelname)s] [%(name)s]: %(message)s", format="%(asctime)s | [%(levelname)s] [%(name)s]: %(message)s",
datefmt="%Y-%m-%d %H:%M:%S", datefmt=DATE_FMT,
force=True, force=True,
) )