Skip to content

feat: add set_logging_level functionality#398

Merged
johannaSommer merged 2 commits intoPrunaAI:mainfrom
pranayyb:feat/logger
Oct 7, 2025
Merged

feat: add set_logging_level functionality#398
johannaSommer merged 2 commits intoPrunaAI:mainfrom
pranayyb:feat/logger

Conversation

@pranayyb
Copy link
Copy Markdown
Contributor

@pranayyb pranayyb commented Oct 7, 2025

Description

Added a utility function set_logging_level to configure the global pruna_logger logging level programmatically or via the PRUNA_LOG_LEVEL environment variable. Also added unit tests to verify correct behavior for valid and invalid logging levels.

Related Issue

Fixes #351

Type of Change

  • New feature

How Has This Been Tested?

  • Programmatically setting logging levels (DEBUG, INFO, WARNING, ERROR, CRITICAL)
  • Setting logging levels via environment variable (PRUNA_LOG_LEVEL)
  • Validation that invalid logging levels raise ValueError
  • All tests pass locally using pytest

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my feature works
  • New and existing unit tests pass locally with my changes

Additional Notes

  • Default logging level is INFO if none is provided and environment variable is not set.
  • Function raises a clear error message if an invalid logging level is passed.

Note

Introduce set_logging_level to configure pruna_logger (programmatically or via PRUNA_LOG_LEVEL) and add tests for valid/invalid levels.

  • Logging:
    • Add set_logging_level in src/pruna/logging/logger.py to configure pruna_logger via argument or PRUNA_LOG_LEVEL env var; validates against supported levels and applies at import.
  • Tests:
    • Add tests/config/test_logging.py covering programmatic level setting, env-based setting, and invalid level error handling.

Written by Cursor Bugbot for commit 9c23000. This will update automatically on new commits. Configure here.

@johannaSommer johannaSommer self-requested a review October 7, 2025 07:27
Copy link
Copy Markdown
Member

@johannaSommer johannaSommer left a comment

Choose a reason for hiding this comment

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

LGTM, thanks a lot @pranayyb

@johannaSommer johannaSommer changed the title feat: add set_logging_level functionality feat: add set_logging_level functionality Oct 7, 2025
@johannaSommer johannaSommer merged commit 3635eda into PrunaAI:main Oct 7, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

3 participants