Skip to main content

ansilogs

Colored, single-line log output for command-line tools. A small, dependency-free replacement for coloredlogs.install() with the same default look.

import logging

import ansilogs

ansilogs.install(logging.DEBUG)
logging.getLogger(__name__).warning("careful")
2026-10-19 09:35:12 my-host my_tool.cli[4242] WARNING careful
  • One line per record: <time> <host> <name>[<pid>] <LEVEL> <message>; tracebacks follow uncolored.
  • Colors only when stderr is a terminal. NO_COLOR (non-empty) disables them, FORCE_COLOR (non-empty) forces them. On Windows the console is switched to ANSI processing; if that fails, output is plain.
  • Records go to whatever sys.stderr is at the time (test capture and live progress displays that redirect stderr keep working).

API

  • install(level=logging.INFO, colors=None): attach the handler to the root logger (once) and show records from level up. colors=None means supports_color().
  • set_level(level): change the shown level (installs the handler if needed).
  • supports_color(stream=None): the color decision used by install().
  • ColoredFormatter(colors=True, hostname=None) and StderrHandler for custom setups.

Migrating from coloredlogs

-import coloredlogs
-coloredlogs.install(level=logging.DEBUG)
+import ansilogs
+ansilogs.install(logging.DEBUG)

coloredlogs.set_level(level) becomes ansilogs.set_level(level). COLOREDLOGS_* environment variables and custom field/level styles are not supported.

Metadata

Release files for ansilogs 1.0.0

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

Source distribution (sdist)

Source distribution for ansilogs 1.0.0
File Size Uploaded Provenance Actions
ansilogs-1.0.0.tar.gz 10.4 kB With provenance Details for ansilogs-1.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 17.0 kB

Release files / ansilogs-1.0.0.tar.gz

Download URL ansilogs-1.0.0.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
32b7be0eedb995ddfc22e14e68da1523dbcc2f0ebfe862faaa569359f47dd33b
BLAKE2b-256 checksum
How to use checksums
9557471def37dd3f4ae1201f4554c1d29d4cfa0089fe1d39eeb6c689543749ce
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 19, 2026.

Transparency log

Release files / ansilogs-1.0.0-py3-none-any.whl

Download URL ansilogs-1.0.0-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cd31e6fbd4e2a5a81c87c0e919d3cc29e8704e9f3ba3504e9400d91425d7f8a1
BLAKE2b-256 checksum
How to use checksums
98d7dc3eee2884c60f8760e16d9fbb73495d4af445c41597ce766a2834123aaf
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 19, 2026.

Transparency log

Security for ansilogs 1.0.0

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 ansilogs-1.0.0.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 19, 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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files Full provenance

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