From e8cb5c14772a5de6a43075bc8e2f05638f4c08f0 Mon Sep 17 00:00:00 2001 From: Seth Mackert Date: Fri, 10 Jan 2025 15:22:36 -0500 Subject: [PATCH] fix: rm xtra log location --- pyproject.toml | 2 +- src/kshift/main.py | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 412c62b..e50e77a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "kshift" -version = "1.0.0" +version = "1.0.1" authors = [ { name="Seth Mackert", email="seth.mackert@fastsycamore.com" }, ] diff --git a/src/kshift/main.py b/src/kshift/main.py index 92de144..9e2c9e3 100755 --- a/src/kshift/main.py +++ b/src/kshift/main.py @@ -30,16 +30,15 @@ cache_dir = log_file.parent cache_dir.mkdir(parents=True, exist_ok=True) -logging.basicConfig(filename=log_file, - level=logging.INFO, - format="%(asctime)s - %(levelname)s - %(message)s", - datefmt="%Y-%m-%d %H:%M:%S") - -handler = RotatingFileHandler("theme_changes.log", - maxBytes=1 * 1024 * 1024, - backupCount=1) -logging.getLogger().addHandler(handler) +# Setup RotatingFileHandler for the same file +handler = RotatingFileHandler(log_file, maxBytes=1 * 1024 * 1024, backupCount=1) +formatter = logging.Formatter( + "%(asctime)s - %(levelname)s - %(message)s", datefmt="%Y-%m-%d %H:%M:%S" +) +handler.setFormatter(formatter) +# Configure logging +logging.basicConfig(level=logging.INFO, handlers=[handler]) def log_theme_change(theme_name): """