Skip to main content

# 033[1;31m [ANSIlog] 033[0m: Utilities for colorful output, logging, and # basic terminal control.

ansilog is a CLI-focused module that provides colorful output primitives and basic terminal control. It currently supports 16-color terminal escape sequences, along with various ANSI control sequences, attributes, and some extra terminal control features. It also offers ansilog.StreamHandler, which can be added to loggers to enable colorized log levels and other colorized output. ansilog is smart enough to know when it is writing to a tty or a file, and will strip all ANSI sequences before writing to files.

Colors and attributes are wrapped in a convenient tag interface, with the ansilog.print() function and ansilog.StreamHandler being able to convert these tags to output strings and strip ANSI sequences from them when necessary.

The tags help automate the labor of resetting to terminal defaults (and previous highlights) when switching between highlight modes. You can include any number of string-able objects in the tag factory function and they will be concatenated.

ANSIlog respects the NO_COLOR environment variable in that all color and format sequences will be ignored if it is set, however cursor escapes and explicitly constructed escape sequences (ala seq()) will not be suppressed.

` from ansilog import * print('Welcome to the ', bright(fg.red('U'), fg.white('S'), fg.blue('A')), '!', sep = '') `

For more precise control, you can output the colors and attributes directly as well, but you must remember to reset afterwards.

` from ansilog import * print('Welcome to the ', bright, fg.red, 'U', fg.white, 'S', fg.blue, 'A', reset, '!', sep = '') `

### License ANSIlog is released under a 3 clause BSD license. See LICENSE for more details.

Metadata

Release files for ansilog 1.6

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

Source distribution (sdist)

Source distribution for ansilog 1.6
File Size Uploaded Provenance Actions
ansilog-1.6.tar.gz 6.8 kB Without provenance Details for ansilog-1.6.tar.gz

Release files / ansilog-1.6.tar.gz

Download URL ansilog-1.6.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7cb6af1ca1e2d28d3af174a82ccd77d7a4a7837dfdb238c6cf6d3004b040c3ba
BLAKE2b-256 checksum
How to use checksums
5d547d63b7bb36470ad3a6e7d4d651d197c2710207e356d17dd69ea01323ff44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

Security for ansilog 1.6

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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