Skip to main content

A convenient logging configuration manager for Python's standard logging library and Loguru.

Project description

Loggia

PyPI - Version PyPI - Python Version PyPI - License pdm-managed types - Mypy Hatch project linting - Ruff

The documentation is available on Github Pages

Read it online

Objective

The objective of this package is to provide a simple and standard way to configure logging in Python applications, using the standard logging module, and compatible with loguru.

We aim for a batteries-included, no configuration required, delightful out-of-the box experience.

The bundled configuration is opinionated and suits our purposes well, but we recognize your opinion will differ and provide various mechanisms of increasing complexity to tune logging to your liking.

Loggia is not a new Python logger - it's a nice way to configure - and share configuration - for Python's standard logging and as well as loguru.

!!! warning While this package is in an early 0.x release, it's built upon years of development and production usage in various projects.

Loggia as a logging configuration bundle is young, but the configuration
itself is what we most enjoyed working with for some time now.

Usage

  1. Add the loggia dependency to your project, e.g.: with PDM:
    • Directly from Pypi: pdm add loggia
    • With Git: pdm add "loggia @ git+ssh://git@github.com/manomanotech/loggia.git"
  2. #!python from loggia.logger import initialize; initialize() is a strong starting point
    • You should call this as early as possible in your application, ideally before any other code is run, for instance by adding it in your main __init__.py file.
  3. Read the Usage docs should you need to tune things.

Features

  • Delightful standard logging configuration in pretty or structured mode
  • Compatibility with loguru (WIP) - you can keep using Loguru's API as much as you like or need it, while Loggia takes care of all the other standard-logging based loggers.
  • Configuring sys.excepthook to properly log uncaught exceptions
  • Using logging.captureWarnings to log warnings
  • Configuring the standard logger and loguru to use the same handlers
  • Only one non-optional dependency

Code standards & Principles

  • Lean towards being way too typed rather than untyped
  • Do not depend on third-party packages (WIP)
  • Do not crash unless explicitly asked to - fallback to sensible things, emit a warning, and move on.

Supported versions

We currently support Python 3.9, 3.10, 3.11 and 3.12.

We may drop the support for a Python version before its end of life, to keep the codebase up to date with the latest Python features: i.e.: we will endeavor to support either the last 3 or 4 stable Python releases.

We don't plan to support earlier versions or different runtimes.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

loggia-0.3.1.tar.gz (40.4 kB view details)

Uploaded Source

Built Distribution

loggia-0.3.1-py3-none-any.whl (37.1 kB view details)

Uploaded Python 3

File details

Details for the file loggia-0.3.1.tar.gz.

File metadata

  • Download URL: loggia-0.3.1.tar.gz
  • Upload date:
  • Size: 40.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.13.2 CPython/3.10.12 Linux/6.5.0-1016-azure

File hashes

Hashes for loggia-0.3.1.tar.gz
Algorithm Hash digest
SHA256 6e6525819688e79e833c15d390af0d3f334c30080cd4e114667cb62192c23d09
MD5 67b1f40b644945d05aad37bd13a820c7
BLAKE2b-256 1496f2a12aa2998517f5c2daa3d3c1a8accb0b76fa98b1a2c636a797fe9bae6e

See more details on using hashes here.

File details

Details for the file loggia-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: loggia-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 37.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.13.2 CPython/3.10.12 Linux/6.5.0-1016-azure

File hashes

Hashes for loggia-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f7b6b21ec129bbeb39332f61e6bea2a08443a2d0185b2aecb0ca51b5f77bfa45
MD5 8f029086be4d0810d5420569f0a2fa29
BLAKE2b-256 9d96b11e39dfd2d36ced3a03e250513290ff7b9575d67b5bf4cf13e2ee4797f5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page