Skip to content

Commit

Permalink
feat: allow setting log level in global conf
Browse files Browse the repository at this point in the history
  • Loading branch information
phil65 committed Nov 30, 2024
1 parent 191a0f9 commit 656505d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/llmling/config/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@


ResourceType = Literal["path", "text", "cli", "source", "callable", "image"]
LogLevel = Literal["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]


class GlobalSettings(BaseModel):
Expand All @@ -40,6 +41,9 @@ class GlobalSettings(BaseModel):
prefer_uv: bool = False
"""Explicitely use uv for package installation / management """

log_level: LogLevel = "INFO"
"""Log level to use for the server"""

model_config = ConfigDict(frozen=True)


Expand Down
3 changes: 2 additions & 1 deletion src/llmling/server/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from llmling import config_resources
from llmling.config.manager import ConfigManager
from llmling.config.runtime import RuntimeConfig
from llmling.core.log import get_logger
from llmling.core.log import get_logger, setup_logging
from llmling.server.server import LLMLingServer


Expand Down Expand Up @@ -38,6 +38,7 @@ def create_server(
# Load and validate config
path = config_path or config_resources.TEST_CONFIG
manager = ConfigManager.load(path)
setup_logging(level=manager.config.global_settings.log_level)

# Log any validation warnings
if warnings := manager.validate():
Expand Down

0 comments on commit 656505d

Please sign in to comment.