Skip to main content

logistro (lo-hī-stro)

logistro is an extremely light addition to logging, providing sensible defaults.

It also includes getPipeLogger() which can be passed to Popen() so that its stderr is piped to the already thread-safe logging library.

Which logger level should I use?

debug2 I use if I'm in a situation where it's okay to dump large amounts of information. I'm planning on scrolling.

info I will maybe use at the beginning and end of functions called.

debug Might print stuff from inside functions or it might print shortened versioning of debug2.

Warning, Error, Critical, Exception, these are all more obvious.

Quickstart

import logistro

logger = logistro.getLogger(__name__)

logger.debug2(...) # new!
logger.debug(...) # or debug1()
logger.info(...)
logger.warning(...)
logger.error(...)
logger.critical(...)
logger.exception(...) # always inside except:

# For subprocesses:

pipe, logger = logistro.getPipeLogger(__name__+"-subprocess")
subprocess.Popen(cli_command, stderr=pipe)
os.close(pipe) # eventually

CLI Flags

  • --logistro-level DEBUG|DEBUG2|INFO|WARNING|ERROR|CRITICAL
  • --logistro-human (default)
  • --logistro-structured which outputs JSON

The help for CLI commands can be included in your program:

parser = argparse.ArgumentParser(parents=[logistro.parser])

Functions

  • logistro.set_structured()
  • logistro.set_human()

Generally, they must be called before any other logging call (See note below).

Additionally

logistro.betterConfig(...) applies our formats and levels. It accepts the same arguments as logging.basicConfig(...) except format=, which it ignores. It is better to call this early in a multithread program.

logistro.getLogger(...) will ensure betterConfig().

You can use our two formatters manually instead:

  • human_formatter
  • structured_formatter

Changing Logger Formatter Mid-Execution

With a typical setup, calling set_structured() or set_human() and then logistro.coerce_logger(logistro.getLogger()) will change the format.

See the tech note for an intro into the complexities of logging.

Metadata

Release files for logistro 2.0.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 logistro 2.0.1
File Size Uploaded Provenance Actions
logistro-2.0.1.tar.gz 8.4 kB With provenance Details for logistro-2.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for logistro 2.0.1
File Interpreter ABI Platform Actions
logistro-2.0.1-py3-none-any.whl Python 3 none any Details for logistro-2.0.1-py3-none-any.whl

Total release size: 17.0 kB

Release files / logistro-2.0.1.tar.gz

Download URL logistro-2.0.1.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8446affc82bab2577eb02bfcbcae196ae03129287557287b6a070f70c1985047
BLAKE2b-256 checksum
How to use checksums
0890bfd7a6fab22bdfafe48ed3c4831713cb77b4779d18ade5e248d5dbc0ca22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Nov 1, 2025.

Transparency log

Release files / logistro-2.0.1-py3-none-any.whl

Download URL logistro-2.0.1-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
06ffa127b9fb4ac8b1972ae6b2a9d7fde57598bf5939cd708f43ec5bba2d31eb
BLAKE2b-256 checksum
How to use checksums
54206aa79ba3570bddd1bf7e951c6123f806751e58e8cce736bad77b2cf348d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Nov 1, 2025.

Transparency log

Security for logistro 2.0.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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for logistro-2.0.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 Nov 1, 2025.

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