InspyLogger
InspyLogger is a colorful, hierarchical logging library for Python CLI applications. It keeps the standard library's logging semantics while adding named singleton devices, child loggers, Rich console output, file output, and one-time warnings.
Version 3.2.4 supports Python 3.10 and newer.
Installation
python -m pip install inspy-logger
To install this checkout for development, use poetry install --with dev,docs.
Quick start
from inspy_logger import InspyLogger
log = InspyLogger(
"my-app",
console_level="info",
file_level="debug",
file_name="my-app.log",
)
log.debug("Written to the file, but hidden from the console")
log.info("Started %s", "successfully")
log.warning("Something may need attention")
InspyLogger(name, ...) returns the same logger device for repeated uses of a
name. Log methods accept the same positional formatting arguments as
logging.Logger.
Console-only logging
log = InspyLogger(
"console-app",
console_level="warning",
no_file_logging=True,
)
With no_file_logging=True, no file handler is installed and no log file is
created.
Child loggers
database_log = log.get_child("database")
query_log = log.get_child("database.query")
database_log.info("Connected")
query_log.debug("Executing %s", statement)
Child retrieval is stable: requesting the same child name returns the same device and does not add duplicate handlers.
Logging-enabled classes
from inspy_logger import Loggable
class Worker(Loggable):
def run(self):
self.method_logger.info("Worker started")
worker = Worker(parent_log_device=log)
worker.run()
method_logger resolves to a child named for the calling method. It remains a
descriptor, so each method gets the correct child rather than an instance
attribute captured during initialization.
Levels and handlers
Console and file levels are independent. The wrapped logging.Logger is kept
at the lowest enabled handler level, so a configuration such as console
WARNING plus file DEBUG works as expected.
The supported named levels are internal, debug, info, warning, error,
critical, and fatal. Integer levels from logging are also accepted.
Compatibility
The v2 start() method remains available as a deprecated compatibility shim.
New code should use the logger returned by InspyLogger(...) directly.
Development
poetry install --with dev
poetry run pytest
poetry build
The contract suite covers identity, hierarchy, handler configuration,
independent levels, caller attribution, Loggable, warn_once(), and runtime
environment detection.
License
InspyLogger is distributed under the MIT License. See LICENSE.md.
Metadata
Release files for inspy-logger 3.2.4
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 |
|---|---|---|---|---|
| inspy_logger-3.2.4.tar.gz | 42.3 kB | Without provenance | Details for inspy_logger-3.2.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| inspy_logger-3.2.4-py3-none-any.whl | Python 3 | none | any | Details for inspy_logger-3.2.4-py3-none-any.whl |
Total release size: 101.5 kB
Release files / inspy_logger-3.2.4.tar.gz
| Download URL | inspy_logger-3.2.4.tar.gz |
|---|---|
| Size | 42.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
efd1887eabe153864635b408588906ab86a44b63a67be8c04e999600cc3934e7
|
|
BLAKE2b-256 checksum How to use checksums |
a2ee812e7672830f07181e4deef0f536cd130b5157b134d201738cfd44206e39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.14.7 Windows/11
|
Release files / inspy_logger-3.2.4-py3-none-any.whl
| Download URL | inspy_logger-3.2.4-py3-none-any.whl |
|---|---|
| Size | 59.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
21bebe93865d3fee526e328ea76e4914d60ebdd30f4b8e99d25310cbcfc2d070
|
|
BLAKE2b-256 checksum How to use checksums |
fe2f3949eaabaf1c627dc9edd763ebac455df9ef5f72c8751b01a3f145037adb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.2.1 CPython/3.14.7 Windows/11
|
Security for inspy-logger 3.2.4
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.