Skip to main content

ansilogs

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

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.
  • The default style dims the time, host and pid, shows the logger name in cyan and the level name in its severity color (debug output dimmed). style="coloredlogs" reproduces coloredlogs' look byte for byte.
  • 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, style="default"): attach the handler to the root logger (once) and show records from level up. colors=None means supports_color(); style is "default" or "coloredlogs" (see STYLES).
  • 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, style="default") and StderrHandler for custom setups.

Migrating from coloredlogs

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

Pass style="coloredlogs" to keep the exact coloredlogs colors. 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.1.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.1.0
File Size Uploaded Provenance Actions
ansilogs-1.1.0.tar.gz 11.1 kB With provenance Details for ansilogs-1.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 18.4 kB

Release files / ansilogs-1.1.0.tar.gz

Download URL ansilogs-1.1.0.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
15f0e3581f9e14d0ddadd3795408878ef6d9023966607abadfa718f24baff882
BLAKE2b-256 checksum
How to use checksums
6be04b3b453aec055d6cb3cce3650953a6fabc28e42e586d5400f1db41919398
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.1.0-py3-none-any.whl

Download URL ansilogs-1.1.0-py3-none-any.whl
Size 7.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8cfea017cb071bed082309c67d086bbf259ce39524d85b1a9d6b0da55af6e0fc
BLAKE2b-256 checksum
How to use checksums
c6b26dfc605421830719fa46a75a585478ac57e6a1cfd192779c61f2b6612478
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.1.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.1.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.1.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