weavel-ai / Ape

Your first AI prompt engineer
https://docs.weavel.ai/sdk-reference/ape-common
MIT License
331 stars 13 forks source link

[refactor] Improve logging and error handling #32

Closed aschung01 closed 1 week ago

aschung01 commented 1 week ago

Description

This pull request refactors and improves the logging and error handling in the ape-common library. The main changes include:

  1. Enhanced error handling in the Evaluate class (evaluate.py):

    • Replaced outputs with example in the EvaluationResult returned on error.
  2. Significant refactoring of the logging system (logging.py):

    • Removed custom TypedBoundLogger class in favor of standard structlog.stdlib.BoundLogger.
    • Introduced LOGGER_NAME constant for consistent logger naming.
    • Improved logging configuration for better customization and readability.
    • Added _create_rich_renderer method for custom log formatting.
    • Updated LogSettings class to use the new configuration.
  3. Version bump:

    • Updated version to 0.1.4 in pyproject.toml.

Notes: The changes aim to improve the logging system's flexibility and readability. The new _create_rich_renderer method allows for custom log formatting, potentially reducing redundant information in log outputs. The version bump to 0.1.4 likely represents these logging improvements and minor refactoring.

Changes that Break Backward Compatibility

The removal of the custom TypedBoundLogger class and the switch to structlog.stdlib.BoundLogger may potentially break backward compatibility for code that explicitly relied on the custom logger implementation. Users of the library may need to update their code if they were directly using any methods or attributes specific to the removed TypedBoundLogger class.

Documentation

N/A

Created with Palmier

aschung01 commented 1 week ago

@palmier-bot review

aschung01 commented 1 week ago

@palmier-bot describe