Skip to content

feat(core): add configure_logging() API for user controlled log setup#5068

Open
eelkeh wants to merge 2 commits intolivekit:mainfrom
eelkeh:feat/configure-logging-api
Open

feat(core): add configure_logging() API for user controlled log setup#5068
eelkeh wants to merge 2 commits intolivekit:mainfrom
eelkeh:feat/configure-logging-api

Conversation

@eelkeh
Copy link

@eelkeh eelkeh commented Mar 10, 2026

Add a public configure_logging() function in livekit.agents.log that 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.

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.
@CLAassistant
Copy link

CLAassistant commented Mar 10, 2026

CLA assistant check
All committers have signed the CLA.

devin-ai-integration[bot]

This comment was marked as resolved.

…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants