Skip to main content

Aidbox $loggy python logging

Project description

build status codecov pypi Checked with mypy Supported Python version

aidbox-logging-py

Aidbox $loggy python logging handler with queue

Installation

Install from pypi as aidbox-logging

Usage

from aidbox_logging import init_queued_aidbox_loggy_handler, enable_excepthook_logging


logging.basicConfig(
    format="[%(asctime)s] [%(process)d] [%(levelname)s] %(name)s %(message)s",
    datefmt="%Y-%m-%d %H:%M:%S %z",
)
root_logger = logging.getLogger()
root_logger.setLevel(logging.DEBUG)
if env_config.loggy_url:
    loggy_handler = init_queued_aidbox_loggy_handler(
        env_config.loggy_url,
        app="lab-backend",
        version=f"{version.__version__}-{version.__build_commit_hash__}",
        meta={
            "env": env_config.lab_room_id,
        },
    )

    # By default all log messages will be handled by loggy
    root_logger.addHandler(loggy_handler)

    # By default gunicorn errors are not propagated, so we handle it explicitly
    logging.getLogger("gunicorn.error").addHandler(loggy_handler)

    # Optional: enable excepthook logging that intercepts all exceptions inside threads
    enable_excepthook_logging()

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

aidbox_logging-0.1.0a0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aidbox_logging-0.1.0a0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file aidbox_logging-0.1.0a0.tar.gz.

File metadata

  • Download URL: aidbox_logging-0.1.0a0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.6

File hashes

Hashes for aidbox_logging-0.1.0a0.tar.gz
Algorithm Hash digest
SHA256 de02304a2457a5311206131570fb3e07220c233203fb877a5749931023efd536
MD5 4e527547ad3276e6659f111b2a391523
BLAKE2b-256 aa96fc34832858fa8753f6e96759e01119d6d8b27bb0b32584b72e476ed5fefc

See more details on using hashes here.

File details

Details for the file aidbox_logging-0.1.0a0-py3-none-any.whl.

File metadata

File hashes

Hashes for aidbox_logging-0.1.0a0-py3-none-any.whl
Algorithm Hash digest
SHA256 85e9a99618c5cbc55793f02da476cc3b0e8ca44c3cc08633a6cb2594576a7d46
MD5 e4de76a23f2382885d03220854bc7569
BLAKE2b-256 5d7a344eae54358000ed053a40693d2ba9c681d31a1d6b40021aa64dff6e697d

See more details on using hashes here.

Supported by

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