From d0b641d27ab78fd5dfb5fd21ad94e1037d7c5ccd Mon Sep 17 00:00:00 2001 From: notactuallyfinn Date: Wed, 7 Oct 2026 15:14:47 +0200 Subject: [PATCH 1/3] remove auditfile from log handlers and formatters --- src/hermes/logger.py | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/hermes/logger.py b/src/hermes/logger.py index 2c184f79..19dce9f5 100644 --- a/src/hermes/logger.py +++ b/src/hermes/logger.py @@ -15,8 +15,7 @@ 'formatters': { 'plain': {'format': "%(message)s"}, - 'logfile': {'format': "%(created)16f:%(name)20s:%(levelname)10s | %(message)s"}, - 'auditlog': {'format': "%(asctime)s %(name)-20s %(message)s"}, + 'logfile': {'format': "%(created)16f:%(name)20s:%(levelname)10s | %(message)s"} }, 'handlers': { @@ -32,22 +31,14 @@ 'formatter': "logfile", 'level': "DEBUG", 'filename': "./hermes.log", - }, - - 'auditfile': { - 'class': "logging.FileHandler", - 'formatter': "plain", - 'level': "DEBUG", - 'filename': "./.hermes/audit.log", - 'mode': "w", - }, + } }, 'loggers': { 'cli': {'level': "DEBUG", 'handlers': ['terminal']}, 'hermes': {'level': "DEBUG", 'handlers': ['terminal', 'logfile']}, - 'audit': {'level': "DEBUG", 'handlers': ['terminal', 'logfile']}, - }, + 'audit': {'level': "DEBUG", 'handlers': ['terminal', 'logfile']} + } } _loggers = {} @@ -59,7 +50,6 @@ def init_logging(): # Make sure the directories to hold the log files exists (or else create) pathlib.Path(_logging_config['handlers']['logfile']['filename']).parent.mkdir(exist_ok=True, parents=True) - pathlib.Path(_logging_config['handlers']['auditfile']['filename']).parent.mkdir(exist_ok=True, parents=True) # Inintialize logging system import logging.config From 15d1a763ff3cc5167d3a8e4c90278ac6522de9a4 Mon Sep 17 00:00:00 2001 From: notactuallyfinn Date: Wed, 7 Oct 2026 15:15:33 +0200 Subject: [PATCH 2/3] add exception handling to shutil.rmtree in init and clean commands --- src/hermes/commands/clean/base.py | 12 +++++++----- src/hermes/commands/init/base.py | 9 ++++++++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/hermes/commands/clean/base.py b/src/hermes/commands/clean/base.py index b588faf5..02931858 100644 --- a/src/hermes/commands/clean/base.py +++ b/src/hermes/commands/clean/base.py @@ -27,8 +27,10 @@ def __call__(self, args: argparse.Namespace) -> None: self.log.info("Removing HERMES caches...") # Naive implementation for now... check errors, validate directory, don't construct the path ourselves, etc. - shutil.rmtree(args.path / '.hermes') - - def load_settings(self, args: argparse.Namespace): - """No settings are needed for the clean command.""" - pass + try: + path = args.path / '.hermes' + shutil.rmtree(path) + except FileNotFoundError: + pass + except Exception as exc: + self.log.warning(f"{path} couldn't be cleaned: {exc}") diff --git a/src/hermes/commands/init/base.py b/src/hermes/commands/init/base.py index 2f0eb6f8..f94cb01d 100644 --- a/src/hermes/commands/init/base.py +++ b/src/hermes/commands/init/base.py @@ -1000,7 +1000,14 @@ def clean_up_files(self, aborted: bool) -> None: sc.echo("Cleaning unused files...") hidden_hermes_path = Path(".hermes") if hidden_hermes_path.exists() and hidden_hermes_path.is_dir(): - shutil.rmtree(hidden_hermes_path) + try: + shutil.rmtree(hidden_hermes_path) + except Exception as exc: + sc.echo( + f"{hidden_hermes_path} couldn't be cleaned: {exc}", + formatting=sc.Formats.WARNING, + log_as=logging.ERROR + ) if aborted: if not self.hermes_was_already_installed: for path in reversed(self.new_created_paths): From 09ec0f223ac4fe6fc345a921807913744a5eb0e7 Mon Sep 17 00:00:00 2001 From: notactuallyfinn Date: Thu, 8 Oct 2026 11:15:25 +0200 Subject: [PATCH 3/3] remove audit.log from docs --- docs/source/dev/data_model.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/source/dev/data_model.md b/docs/source/dev/data_model.md index c9d59f36..2b011b25 100644 --- a/docs/source/dev/data_model.md +++ b/docs/source/dev/data_model.md @@ -19,7 +19,6 @@ Output of the different `hermes` subcommands consequently are valid JSON-LD file subdirectories of the `.hermes/` directory that is created in the root of the project directory (see following diagram). ``` .hermes -│ audit.log ├──curate │ └──result │ ├──codemeta.json