Skip to main content

 mollog

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

CI PyPI Python License Ruff

Documentation  ·  Quick start  ·  Ecosystem

mollog is a structured logging library for Python that mirrors the standard library's logging API while adding structured extra fields, JSON output, context propagation, and a bridge that funnels stdlib records into its own hierarchy. Migrate from logging.basicConfig without changing your format strings.

Capabilities

Module Capability
_manager Singleton logger registry plus the top-level API: configure / basicConfig, get_logger / getLogger, set_level, shutdown, and trace/debug/info/warning/error/critical/exception helpers
_logger Named Logger with hierarchy, propagation, per-logger levels, bind() for reusable context, and exception/stack capture
_record Immutable frozen LogRecord dataclass — level, message, logger name, timestamp, extra, exception, stack info
_level Level enum — TRACE, DEBUG, INFO, WARNING, ERROR, CRITICAL — with coercion from ints, names, or enum values
_context Context namespace — thread- and asyncio-safe context fields via contextvars; Context.scope() doubles as a logfire span
_handler Handler base class plus StreamHandler and NullHandler
_file_handler FileHandler, RotatingFileHandler, and TimedRotatingFileHandler
_queue QueueHandler and background-thread QueueListener for thread/process-safe logging
_formatter Formatter base plus TextFormatter, JSONFormatter, and stdlib-style StdlibStyleFormatter
_rich RichFormatter — ANSI-styled, color-coded output via rich
_filter Filter base class and LevelFilter for level-range filtering
_stdlib_bridge StdlibBridgeHandler plus capture_stdlib_logging / release_stdlib_logging — routes stdlib logging records through mollog
_logfire Optional LogfireHandler and configure_logfire() for Pydantic Logfire backends

Install

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

Requires Python 3.12+. The only runtime dependency is rich.

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 a 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.

Documentation

The full guide: docs.molcrafts.org/mollog (sources in docs/):

MolCrafts ecosystem

Project Role
molpy Python toolkit — the shared molecular data model & workflow layer
molrs Rust core — molecular data structures & compute kernels (native + WASM)
molpack Packmol-grade molecular packing (Rust + Python)
molvis WebGL molecular visualization & editing
molexp Workflow & experiment-management platform
molnex Molecular machine-learning framework
molq Unified job queue — local / SLURM / PBS / LSF
molcfg Layered configuration library
mollog Structured logging, stdlib-compatible — this repo
molhub Molecular dataset hub
molmcp MCP server for the ecosystem
molrec Atomistic record specification

Contributing

See CONTRIBUTING.md.

License

BSD-3-Clause — see LICENSE.


Crafted with 💚 by MolCrafts

Metadata

Release files for molcrafts-mollog 1.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for molcrafts-mollog 1.3.1
File Size Uploaded Provenance
molcrafts_mollog-1.3.1.tar.gz 48.5 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for molcrafts-mollog 1.3.1
File Interpreter ABI Platform
molcrafts_mollog-1.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 76.0 kB

Release files / molcrafts_mollog-1.3.1.tar.gz

Download URL molcrafts_mollog-1.3.1.tar.gz
Size 48.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d15f700968ecdb1dccd68d9c7edca5eb2595c5360183b1d8467e84ec77fdbda1
BLAKE2b-256 checksum
How to use checksums
1f9b59d604eec7d9e106fcd2f8db65787b5a3cddda73ee3cbb40217dae197c29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Release files / molcrafts_mollog-1.3.1-py3-none-any.whl

Download URL molcrafts_mollog-1.3.1-py3-none-any.whl
Size 27.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
113da22d79bdb9529c6647ee2db8a6a4656bdd5e69aa2214d2ddb29b0a74a6b3
BLAKE2b-256 checksum
How to use checksums
4c6dd3d9d1d6932ce5101dd86cf18d4cfc29e8616e57bd8989aab710b5217550
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Security for molcrafts-mollog 1.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for molcrafts_mollog-1.3.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page