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
logistro-2.0.1.tar.gz 8.4 kB Details

Built distribution (wheel)

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

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

Release history Release notifications | RSS feed

This release

2.0.1 This release

2 release files

2.0.0

2 release files

1.1.0

2 release files

1.0.11

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

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