Skip to content

Commit

Permalink
improve(logs): refine logs configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Guts committed Jun 5, 2024
1 parent b08fe78 commit 4fe8d63
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dicogis/cli/cmd_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def inventory(
logmngr = LogManager(
console_level=logging.DEBUG if verbose else logging.WARNING,
file_level=logging.DEBUG if verbose else logging.INFO,
label=f"{__package_name__}-cli",
label=f"{__package_name__}-cli-inventory",
folder=Path(app_dir).joinpath("logs"),
)
# add headers
Expand Down
15 changes: 8 additions & 7 deletions dicogis/cli/cmd_publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ def publish(

logmngr = LogManager(
console_level=logging.DEBUG if verbose else logging.WARNING,
file_level=logging.DEBUG if verbose else logging.INFO,
label=f"{__package_name__}-cli",
file_level=logging.DEBUG if verbose else logging.WARNING,
label=f"{__package_name__}-cli-publish",
folder=Path(app_dir).joinpath("logs"),
)
# add headers
Expand Down Expand Up @@ -193,11 +193,12 @@ def publish(
or data.get("extras", {}).get("dicogis_signature")
in already_published_signature
):
console_out.print(
f"JSON file {json_file} has the same slug or the same signature "
f"compared with {len(already_published_datasets)} already published "
"datasets. It's not gonna be published."
)
if verbose:
console_out.print(
f"JSON file {json_file} has the same slug or the same signature "
f"compared with {len(already_published_datasets)} already published "
"datasets. It's not gonna be published."
)
counter_ignored += 1
continue

Expand Down
2 changes: 1 addition & 1 deletion dicogis/utils/journalizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def initial_logger_config(self) -> logging.Logger:
# create main logger
logging.captureWarnings(False)
logger = logging.getLogger()
logger.setLevel(logging.INFO)
logger.setLevel(min(self.console_level, self.file_level))

# create console handler - seems to be ignored by click
log_console_handler = logging.StreamHandler()
Expand Down

0 comments on commit 4fe8d63

Please sign in to comment.