Skip to content

Commit

Permalink
Merge pull request #223 from elfkuzco/normalize-logger
Browse files Browse the repository at this point in the history
add flag to show verbose output and log output under one name
  • Loading branch information
benoit74 authored Apr 4, 2024
2 parents 4ac977c + bfd801b commit a30026e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,18 @@ as of 2.0.0.

## [Unreleased]

### Added

- Add support for `--debug` flag to output debug logs

### Changed

- Insert as few rsync URLs as possible in DB when a book selection is made (#220)

### Fixed

- Simplify the logger named (used `gutenberg2zim` instead of `gutenberg2zim.constants`) (#206)

## [2.1.1] - 2024-01-17

### Added
Expand Down
2 changes: 1 addition & 1 deletion src/gutenberg2zim/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"datatables/datatables.min.js",
]

logger = getLogger(__name__, level=logging.DEBUG)
logger = getLogger(NAME, level=logging.INFO)

TMP_FOLDER = "tmp"
TMP_FOLDER_PATH = pathlib.Path(TMP_FOLDER)
10 changes: 9 additions & 1 deletion src/gutenberg2zim/entrypoint.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
import os
import sys

Expand All @@ -22,7 +23,8 @@
"""[--prepare] [--parse] [--download] [--export] [--dev] """
"""[--zim] [--complete] [-m ONE_LANG_ONE_ZIM_FOLDER] """
"""[--title-search] [--bookshelves] [--optimization-cache S3URL] """
"""[--stats-filename STATS_FILENAME] [--publisher ZIM_PUBLISHER]"""
"""[--stats-filename STATS_FILENAME] [--publisher ZIM_PUBLISHER] """
"""[--debug]"""
"""
-h --help Display this help message
Expand Down Expand Up @@ -64,6 +66,7 @@
"""optimization cache
--stats-filename=<filename> Path to store the progress JSON file to
--publisher=<zim_publisher> Custom Publisher in ZIM Metadata (openZIM otherwise)
--debug Enable verbose output
This script is used to produce a ZIM file (and any intermediate state)
of Gutenberg repository using a mirror."""
Expand Down Expand Up @@ -104,6 +107,11 @@ def main():
use_any_optimized_version = arguments.get("--use-any-optimized-version", False)
stats_filename = arguments.get("--stats-filename") or None
publisher = arguments.get("--publisher") or "openZIM"
debug = arguments.get("--debug") or False

if debug:
for handler in logger.handlers:
handler.setLevel(logging.DEBUG)

s3_storage = None
if optimization_cache:
Expand Down

0 comments on commit a30026e

Please sign in to comment.