From 770e24b935f36cddff138dc307dc6cf9f09d9267 Mon Sep 17 00:00:00 2001 From: Colm Talbot Date: Fri, 23 Jan 2026 09:24:04 -0500 Subject: [PATCH 1/2] FEAT: make loglevel configurable --- sotrplib/cli.py | 7 +++++++ sotrplib/config/config.py | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/sotrplib/cli.py b/sotrplib/cli.py index 63335c13..a996925c 100644 --- a/sotrplib/cli.py +++ b/sotrplib/cli.py @@ -2,11 +2,18 @@ Command-line interface for sotrplib. """ +import logging from argparse import ArgumentParser from pathlib import Path +import structlog + from sotrplib.config.config import Settings +structlog.configure( + wrapper_class=structlog.make_filtering_bound_logger(logging.INFO), +) + def parse_args() -> ArgumentParser: ap = ArgumentParser( diff --git a/sotrplib/config/config.py b/sotrplib/config/config.py index 35e8dc63..271f0e8f 100644 --- a/sotrplib/config/config.py +++ b/sotrplib/config/config.py @@ -1,3 +1,4 @@ +import logging from pathlib import Path from typing import Any, Literal @@ -102,6 +103,8 @@ class Settings(BaseSettings): profile: bool = False "Enable pyinstrument profiling" + loglevel: int | str = logging.INFO + # Read environment and command line settings to override default model_config = SettingsConfigDict(env_prefix="sotrp_", extra="ignore") @@ -112,6 +115,9 @@ def from_file(cls, config_path: Path | str) -> "Settings": return cls.model_validate_json(handle.read()) def to_dependencies(self) -> dict[str, Any]: + structlog.configure( + wrapper_class=structlog.make_filtering_bound_logger(self.loglevel), + ) log = structlog.get_logger() contents = { From 3a8132fe0c3a6db31601dea40f380ec5d50e3da1 Mon Sep 17 00:00:00 2001 From: Colm Talbot Date: Thu, 5 Feb 2026 15:40:05 -0500 Subject: [PATCH 2/2] TYPO: update the name for log level setting --- sotrplib/config/config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sotrplib/config/config.py b/sotrplib/config/config.py index 271f0e8f..bd2ed5ed 100644 --- a/sotrplib/config/config.py +++ b/sotrplib/config/config.py @@ -103,7 +103,7 @@ class Settings(BaseSettings): profile: bool = False "Enable pyinstrument profiling" - loglevel: int | str = logging.INFO + log_level: int | str = logging.INFO # Read environment and command line settings to override default model_config = SettingsConfigDict(env_prefix="sotrp_", extra="ignore") @@ -116,7 +116,7 @@ def from_file(cls, config_path: Path | str) -> "Settings": def to_dependencies(self) -> dict[str, Any]: structlog.configure( - wrapper_class=structlog.make_filtering_bound_logger(self.loglevel), + wrapper_class=structlog.make_filtering_bound_logger(self.log_level), ) log = structlog.get_logger()