feat: support log level via ServerOptions and LIVEKIT_LOG_LEVEL env var#5112
Open
onurburak9 wants to merge 5 commits intolivekit:mainfrom
Open
feat: support log level via ServerOptions and LIVEKIT_LOG_LEVEL env var#5112onurburak9 wants to merge 5 commits intolivekit:mainfrom
onurburak9 wants to merge 5 commits intolivekit:mainfrom
Conversation
Add `log_level` field to `ServerOptions` and `AgentServer` so users can configure log level programmatically instead of only through the CLI `--log-level` argument. Also add `LIVEKIT_LOG_LEVEL` environment variable support for the `start` and `dev` commands. Priority: CLI arg > env var > ServerOptions.log_level > per-mode default Closes livekit#4340
longcw
reviewed
Mar 16, 2026
Contributor
longcw
left a comment
There was a problem hiding this comment.
looks good to me. could you fix the CI failures?
Only valid LogLevel values (TRACE, DEBUG, INFO, WARN, ERROR, CRITICAL) are accepted by ServerOptions and AgentServer. Invalid values raise ValueError immediately at construction time.
96ed7e0 to
26887d1
Compare
Lowercase values like "info" or "debug" passed to ServerOptions or AgentServer are now normalized to uppercase, preventing a ValueError when LogLevel enum is constructed in _build_cli.
Author
@longcw CI passed, ready for a review |
longcw
approved these changes
Mar 17, 2026
Contributor
longcw
left a comment
There was a problem hiding this comment.
looks good to me, something nit:
| _dev_log_default = LogLevel(ServerEnvOption.getvalue(server.log_level, True)) | ||
|
|
||
| @app.command() | ||
| def console( |
Contributor
There was a problem hiding this comment.
maybe add log_level for console mode as well?
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
log_levelfield toServerOptionsandAgentServerso users can configure log level programmatically instead of only through the CLI--log-levelargument. Also addLIVEKIT_LOG_LEVELenvironment variable support for thestartanddevcommands.Priority: CLI arg > env var > ServerOptions.log_level > per-mode default
Ref #4340