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.0.tar.gz (40.4 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.0-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: molcrafts_mollog-1.2.0.tar.gz
  • Upload date:
  • Size: 40.4 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.0.tar.gz
Algorithm Hash digest
SHA256 f919c24bd43085e508d47d41baf919d205da9ca6efdb1541be9853d87421e38f
MD5 e55d0a24486545b0e482370b7cca0be4
BLAKE2b-256 7a7975e04370662d6e4392563eebe6f74a84449c205d39d10f2490142de75cef

See more details on using hashes here.

Provenance

The following attestation bundles were made for molcrafts_mollog-1.2.0.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.0-py3-none-any.whl.

File metadata

File hashes

Hashes for molcrafts_mollog-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0ff30d5bf2acf4945ff0ce1ff66d69892d840fc54bb9b8e93f7f0e58ff73ed25
MD5 c3f6546b627a1a6bd3c1180a3a27bb88
BLAKE2b-256 b63a5591d6082a44b8c94a1aa25e3b0f844e27a8d6907e616a5391479272f5b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for molcrafts_mollog-1.2.0-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