write out messages with various levels: INFO, ERROR, etc...
Description
This module provides a routine to write out a message of various levels such as DEBUG, INFO, WARNING, ERROR and CRITICAL. The messages are high-lighted with different colors if they are going to a terminal. If the output has been redirected to a file, then the colors are turned off. You can also specify to not use colors at all.
Levels DEBUG and INFO go to stdout, while WARNING, ERROR and CRITICAL go to stderr.
Messages for level DEBUG will only be printed if the 1st optional argument debug is set to True.
The second argument (progname) is an optional program name to be printed at the beginning of the message provided.
The third argument (use_color) is an optional program name to control whether to use color on the message level or not. default is True.
Code example
import os
import sys
import argparse
import logging
from cli_logging_moxad import setup_cli_logging
# check for options --debug and --nocolor
parser = argparse.ArgumentParser()
parser.add_argument("-d", "--debug", action="store_true",
help="Enable debug logging")
parser.add_argument("-n", "--nocolor", action="store_false",
help="Disable color output")
args = parser.parse_args()
setup_cli_logging(debug=args.debug,
progname=os.path.basename( sys.argv[0]),
use_color=args.nocolor,
)
logging.debug("Debug message")
logging.info("Info message")
logging.warning("This is a warning!")
logging.error("This is an ERROR!")
logging.critical("Critical issue!!!")
Metadata
Release files for cli-logging-moxad 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cli_logging_moxad-0.7.0.tar.gz | 16.9 kB | Without provenance | Details for cli_logging_moxad-0.7.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cli_logging_moxad-0.7.0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for cli_logging_moxad-0.7.0-py2.py3-none-any.whl |
Total release size: 32.8 kB
Release files / cli_logging_moxad-0.7.0.tar.gz
| Download URL | cli_logging_moxad-0.7.0.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3d1f75538a97174a2bd6836534e05a19f9a5df5bea0a43716b58ff48efc49416
|
|
BLAKE2b-256 checksum How to use checksums |
3b3ff711ed65e561cf24473e5b48cd6fb7ba157ac9be0cf9a91c2d163df6eae9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.12
|
Release files / cli_logging_moxad-0.7.0-py2.py3-none-any.whl
| Download URL | cli_logging_moxad-0.7.0-py2.py3-none-any.whl |
|---|---|
| Size | 15.9 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
500aaf8f3cd66a61378a6341942b9e550fd032d37dd7681006d6904ea32ce55a
|
|
BLAKE2b-256 checksum How to use checksums |
8d52107cdc75ed89ad9644283003115382a5fbbbb127ff80ce6c571db6ccfbea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.12
|
Security for cli-logging-moxad 0.7.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.
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.