Skip to content

feat: support log level via ServerOptions and LIVEKIT_LOG_LEVEL env var#5112

Open
onurburak9 wants to merge 5 commits intolivekit:mainfrom
onurburak9:feat/log-level-worker-options
Open

feat: support log level via ServerOptions and LIVEKIT_LOG_LEVEL env var#5112
onurburak9 wants to merge 5 commits intolivekit:mainfrom
onurburak9:feat/log-level-worker-options

Conversation

@onurburak9
Copy link

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

Ref #4340

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

CLAassistant commented Mar 16, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

Copy link
Contributor

@longcw longcw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me. could you fix the CI failures?

devin-ai-integration[bot]

This comment was marked as resolved.

Only valid LogLevel values (TRACE, DEBUG, INFO, WARN, ERROR, CRITICAL)
are accepted by ServerOptions and AgentServer. Invalid values raise
ValueError immediately at construction time.
@onurburak9 onurburak9 force-pushed the feat/log-level-worker-options branch from 96ed7e0 to 26887d1 Compare March 16, 2026 06:38
devin-ai-integration[bot]

This comment was marked as resolved.

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

looks good to me. could you fix the CI failures?

@longcw CI passed, ready for a review

@onurburak9 onurburak9 requested a review from longcw March 16, 2026 20:25
Copy link
Contributor

@longcw longcw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me, something nit:

_dev_log_default = LogLevel(ServerEnvOption.getvalue(server.log_level, True))

@app.command()
def console(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add log_level for console mode as well?

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.

4 participants