Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop loguru and use builtin logging #1133

Merged
merged 3 commits into from
Oct 29, 2023
Merged

Commits on Oct 29, 2023

  1. Configure simple builtin logging

    Changed the 2 existing `print` in the `private_gpt` code base into actual python logging, stop using loguru (dependency will be dropped in a later commit).
    Try to use the `key=value` logging convention in logs (to indicate what dynamic values represents, and what is dynamic vs not).
    Using `%s` log style, so that the string formatting is pushed inside the logger, giving the ability to the logger to determine if the string need to be formatted or not (i.e. strings from debug logs might not be formatted if the log level is not debug)
    The (basic) builtin log configuration have been placed in `private_gpt/__init__.py` in order to initialize the logging system even before we start to launch any python code in `private_gpt` package (ensuring we get any initialization log formatted as we want to)
    Disabled `uvicorn` custom logging format, resulting in having uvicorn logs being outputted in our formatted.
    
    Some more concise format could be used if we want to, especially:
    ```
    COMPACT_LOG_FORMAT = '%(asctime)s.%(msecs)03d [%(levelname)s] %(name)s - %(message)s'
    ```
    
    Python documentation and cookbook on logging for reference:
    * https://docs.python.org/3/library/logging.html
    * https://docs.python.org/3/howto/logging.html
    louis-jaris authored and lopagela committed Oct 29, 2023
    Configuration menu
    Copy the full SHA
    647f335 View commit details
    Browse the repository at this point in the history
  2. Removing loguru from the dependencies

    Result of `poetry remove loguru`
    louis-jaris authored and lopagela committed Oct 29, 2023
    Configuration menu
    Copy the full SHA
    e9a139d View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b31b4d3 View commit details
    Browse the repository at this point in the history