Skip to content

feat: package-wide configure_logging / LOG_LEVEL#45

Open
eliteprox wants to merge 2 commits into
livepeer:mainfrom
eliteprox:feat/configure-logging
Open

feat: package-wide configure_logging / LOG_LEVEL#45
eliteprox wants to merge 2 commits into
livepeer:mainfrom
eliteprox:feat/configure-logging

Conversation

@eliteprox

@eliteprox eliteprox commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add configure_logging() and LOG_LEVEL env support for the livepeer_gateway package logger
  • Call configure_logging() on package import (sets package level; adds a root handler only if none exist)

Test plan

  • LOG_LEVEL=DEBUG with examples/write_frames.py shows livepeer_gateway.* logs with no example-side logging setup
  • Importing the package in an app that already configured logging does not replace root handlers

@eliteprox
eliteprox requested a review from j0sh as a code owner July 15, 2026 00:42
Call configure_logging() from package __init__ so LOG_LEVEL works without
per-example setup. Revert write_frames to rely on import-time config.
@eliteprox
eliteprox marked this pull request as draft July 15, 2026 00:47
@eliteprox
eliteprox marked this pull request as ready for review July 15, 2026 00:47
@livepeer livepeer deleted a comment from coderabbitai Bot Jul 15, 2026
@j0sh

j0sh commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator
  • I would not add a library-wide env var, see feat(live-runner): env-var fallback for register_runner provisioning fields #34 (comment)
  • Don't call this during package import, because it breaks later application calls to logging.basicConfig(). Let apps invoke the configuration handler on their own, if they want.
  • Let's keep the default BASIC_FORMAT of "%(levelname)s:%(name)s:%(message)s" (see where its used in other examples) and make this configurable by the app
  • Maybe name the file logging.py or thereabouts

Codex also suggested:

invalid level names silently become INFO, while getattr(logging, ...) can resolve attributes that are not logging levels. It should validate against logging.getLevelNamesMapping() and raise ValueError

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