-
Notifications
You must be signed in to change notification settings - Fork 321
Reapply "chore: better logging config" #797
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This reverts commit 9d64b82.
WalkthroughThis PR introduces comprehensive logging configuration to the Kiln AI desktop application. Changes include a new custom log formatter, environment-based log level validation (via KILN_LOG_LEVEL), separate log files for the desktop app and LiteLLM model calls, and integration across the desktop server, dev server, and core logging utilities. Documentation updates explain the logging defaults and configuration options. Changes
Sequence DiagramsequenceDiagram
participant App as App Start
participant DevServer as Dev Server Init
participant Desktop as Desktop Server
participant LogConfig as log_config()
participant Logging as Core Logging
App->>DevServer: Start dev server
DevServer->>Desktop: make_app(litellm_log_filename="dev_model_calls.log")
Desktop->>Logging: setup_litellm_logging("dev_model_calls.log")
Logging->>Logging: get_log_file_path() + get_default_log_file_formatter()
DevServer->>LogConfig: log_config(log_level=validate_log_level(KILN_LOG_LEVEL), log_file_name="dev_kiln_desktop.log")
LogConfig->>LogConfig: Create handlers & formatters<br/>(PrettyPrintDictFormatter)
LogConfig-->>DevServer: Uvicorn log config dict
Note over LogConfig: Logs emitted to:<br/>~/.kiln_ai/logs/dev_kiln_desktop.log<br/>~/.kiln_ai/logs/dev_model_calls.log<br/>stdout (via console handler)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (6)
🧰 Additional context used📓 Path-based instructions (5)app/desktop/**/*.py📄 CodeRabbit inference engine (.cursor/rules/project.mdc)
Files:
{libs,app/desktop}/**/*.py📄 CodeRabbit inference engine (.cursor/rules/project.mdc)
Files:
{libs/core,libs/server,app/desktop}/**/*.py📄 CodeRabbit inference engine (AGENTS.md)
Files:
libs/{core,server}/**/*.py📄 CodeRabbit inference engine (.cursor/rules/project.mdc)
Files:
libs/core/**/*.py📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (3)📓 Common learnings📚 Learning: 2025-08-25T18:52:41.046ZApplied to files:
📚 Learning: 2025-08-29T21:43:55.028ZApplied to files:
🧬 Code graph analysis (5)app/desktop/desktop_server.py (1)
app/desktop/log_config.py (1)
app/desktop/test_log_config.py (1)
app/desktop/dev_server.py (2)
libs/core/kiln_ai/utils/logging.py (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
📊 Coverage ReportOverall Coverage: 92% Diff: origin/main...HEAD
Summary
Line-by-lineView line-by-line diff coverageapp/desktop/log_config.pyLines 21-36 21
22 # check if record has any keys
23 dict_value = getattr(record, "dict", None)
24 if dict_value:
! 25 try:
! 26 if isinstance(dict_value, dict):
! 27 dict_str = json.dumps(dict_value, ensure_ascii=False, indent=2)
28 else:
! 29 dict_str = str(dict_value)
! 30 except Exception as e: # never fail logging due to serialization
! 31 dict_str = f"<unserializable extra.dict: {e.__class__.__name__}>"
! 32 formatted += f"\n{dict_str}"
33
34 return formatted
35
|
This reverts commit 9d64b82. Double revert.
What does this PR do?
Bring back logging config.
WIP:
Summary by CodeRabbit
New Features
KILN_LOG_LEVELenvironment variable (defaults to INFO).~/.kiln_ai/logs/directory.Documentation
Tests