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

add flag to show verbose output and log output under one name #223

Merged
merged 1 commit into from
Apr 4, 2024
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
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

Check warning on line 1 in src/gutenberg2zim/entrypoint.py

View check run for this annotation

Codecov / codecov/patch

src/gutenberg2zim/entrypoint.py#L1

Added line #L1 was not covered by tests
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 @@
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

Check warning on line 110 in src/gutenberg2zim/entrypoint.py

View check run for this annotation

Codecov / codecov/patch

src/gutenberg2zim/entrypoint.py#L110

Added line #L110 was not covered by tests

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

Check warning on line 114 in src/gutenberg2zim/entrypoint.py

View check run for this annotation

Codecov / codecov/patch

src/gutenberg2zim/entrypoint.py#L114

Added line #L114 was not covered by tests

s3_storage = None
if optimization_cache:
Expand Down
Loading