Skip to main content

Structured logging library for the molcrafts ecosystem

Project description

mollog

CI PyPI Ruff Python License

Structured logging for Python with a stdlib-compatible API — no import logging required.

Quick Start

import mollog

mollog.configure(
    level="INFO",
    format="%(asctime)s %(levelname)s %(name)s %(message)s",
)
mollog.get_logger("httpx").set_level("WARNING")  # silence noisy library

mollog.info("service booted", port=8080)

mollog.configure(...) accepts the same format= strings as logging.basicConfig, and by default installs a bridge so records emitted by libraries that still use stdlib logging (httpx, urllib3, openai, …) flow through mollog's hierarchy. Disable with capture_stdlib=False.

pip install molcrafts-mollog
# with optional logfire backend
pip install "molcrafts-mollog[logfire]"

Features

  • Drop-in for logging.basicConfig: stdlib-style format= strings and stdlib bridge
  • Top-level helpers: mollog.{trace, debug, info, warning, error, critical, exception}
  • Per-logger level control: mollog.get_logger("httpx").set_level("WARNING") (propagates to stdlib)
  • Named loggers with hierarchy and propagation
  • Structured extra fields and Logger.bind() for reusable context
  • Context-local fields via the Context namespace (Context.scope(...) doubles as a logfire span)
  • Exception and stack capture on every record
  • TextFormatter, JSONFormatter, RichFormatter, and stdlib-style StdlibStyleFormatter
  • StreamHandler, FileHandler, RotatingFileHandler, TimedRotatingFileHandler, QueueHandler
  • Optional LogfireHandler + configure_logfire() for Pydantic Logfire backends
  • configure() and shutdown() for application lifecycle

Built with love by MolCrafts

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

molcrafts_mollog-1.2.2.tar.gz (43.9 kB view details)

Uploaded Source

Built Distribution

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

molcrafts_mollog-1.2.2-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

File details

Details for the file molcrafts_mollog-1.2.2.tar.gz.

File metadata

  • Download URL: molcrafts_mollog-1.2.2.tar.gz
  • Upload date:
  • Size: 43.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for molcrafts_mollog-1.2.2.tar.gz
Algorithm Hash digest
SHA256 02fa31d11c3ac560440aac68b1709bd41a88318abc712f2c3c6307e2db26880a
MD5 a877f0cfcadcd3a7db7cc4b78f5b7309
BLAKE2b-256 6d542f9345c025460c056d84c61d86f852305fd9863ed95dbcca038e1d61d4cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for molcrafts_mollog-1.2.2.tar.gz:

Publisher: release.yml on MolCrafts/mollog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file molcrafts_mollog-1.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for molcrafts_mollog-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1dc4cacf715aae173f022698a99db8a725ecaf4d504c19336c987ddca6cee426
MD5 262e24d27ac0639cf0d2dd90ca1233e7
BLAKE2b-256 db927b39c0715515965fa0463670c647735aacdfc255cb7fb33d5a4fc15cbf57

See more details on using hashes here.

Provenance

The following attestation bundles were made for molcrafts_mollog-1.2.2-py3-none-any.whl:

Publisher: release.yml on MolCrafts/mollog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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