Skip to content

[FEATURE] Add functionality to adjust the logging level for pruna_logger #351

@johannaSommer

Description

@johannaSommer

✨ What You’ll Do

Right now, our logger is used in the codebase as:

pruna_logger.info("...")
pruna_logger.debug("...")

However, the logging level cannot be easily configured by the user. This makes it harder to control verbosity (for example, if they only want warnings/errors, or if they want more detailed debug output).

You’ll add functionality that lets users adjust the logging level globally, either programmatically or via an environment variable.

🛠️ Dependency

No new dependencies required — Python’s built-in logging module is sufficient.

🤖 Useful Resources

  • The pruna_logger instance is already defined and used throughout the codebase.
  • A possible reference implementation can be found in the diffusers logger utility.
  • You may add a utility function in a module like pruna/logging_utils.py.

➡ Desired Solution

Example usage could look like:

from pruna.logging import set_logging_level

# Option 1: set programmatically
set_logging_level("DEBUG")

# Option 2: set via environment variable
#   export PRUNA_LOG_LEVEL=WARNING

✅ Acceptance Criteria

  • set_logging_level function exists and correctly adjusts the pruna_logger level.
  • Supports common logging levels: DEBUG, INFO, WARNING, ERROR, CRITICAL.
  • Optional support for configuration via environment variable PRUNA_LOG_LEVEL.
  • Users can easily control verbosity of logging output.
  • Tests & Docs: All existing and new unit tests pass, and the documentation is updated

And don’t forget to give us a ⭐️!


❓ Questions?

Feel free to jump into the #contributing Discord channel if you hit any roadblocks. Can’t wait to see your contribution! 🚀


Share on X

Share on X

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions