feat(core): add configure_logging() API for user controlled log setup#5068
Open
eelkeh wants to merge 2 commits intolivekit:mainfrom
Open
feat(core): add configure_logging() API for user controlled log setup#5068eelkeh wants to merge 2 commits intolivekit:mainfrom
eelkeh wants to merge 2 commits intolivekit:mainfrom
Conversation
Add a public configure_logging() function in livekit.agents.log that lets users set custom handlers, formatters, JSON mode, and log levels before the CLI starts. The CLI now detects pre-existing logging configuration and skips its own setup, preventing double-handler issues. Also adds a NullHandler to the livekit.agents logger following Python best-practice for library logging.
…when user has custom handlers Move the _has_user_configured_handlers() guard to wrap only handler creation, leaving _silence_noisy_loggers(), livekit.agents logger level, and plugin logger configuration outside the guard so they always execute.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a public
configure_logging()function inlivekit.agents.logthat allows for custom handlers, formatters, an option for JSON mode, and log levels before the CLI starts. The CLI detects pre-existing logging configuration and skips its own setup, preventing double-handler issues.This is especially useful for using JSON formatted log entries while in dev mode, retaining live reload (which is currently not possible) for log aggregators and/or optimized logs for coding agents.