A comprehensive logging utility for managing application lifecycle logs
Project description
LifecycleLogging
A comprehensive logging utility for managing application lifecycle logs, combining the power of Python's logging with rich output formatting.
Installation
pip install lifecyclelogging
Features
- Configurable console and file logging outputs
- Rich formatting for enhanced readability
- Message storage with context and storage markers
- Verbosity controls with bypass markers
- Case-insensitive level filtering for allowed/denied storage rules
- JSON data attachment support
- Type-safe implementation
- Seamless integration with existing logging systems
- Automatic Gunicorn logger integration
Project Goals
- Provide a batteries-included logging helper that stays compatible with modern Python releases
- Keep configuration ergonomic while remaining type-safe and explicit
- Offer sensible defaults that work locally and in containerized runtimes
- Deliver reliable automation through testing, linting, and release workflows
Basic Usage
from lifecyclelogging import Logging
# Initialize logger
logger = Logging(
enable_console=True, # Enable console output
enable_file=True, # Enable file output
logger_name="my_app"
)
# Basic logging
logger.logged_statement("Basic message", log_level="info")
# With context marker
logger.logged_statement(
"Message with context",
context_marker="STARTUP",
log_level="info"
)
# With JSON data
logger.logged_statement(
"Message with data",
json_data={"key": "value"},
log_level="debug"
)
Advanced Features
Verbosity Control
logger = Logging(
enable_verbose_output=True,
verbosity_threshold=2
)
# Only logged if verbosity threshold allows
logger.logged_statement(
"Detailed debug info",
verbose=True,
verbosity=2,
log_level="debug"
)
Verbosity Bypass Helpers
logger.register_verbosity_bypass_marker("IMPORTANT")
# Will be logged regardless of verbosity settings
logger.logged_statement(
"Critical info",
context_marker="IMPORTANT",
verbose=True,
verbosity=5,
log_level="debug"
)
Message Storage
# Store message under a marker
logger.logged_statement(
"Important event",
storage_marker="EVENTS",
log_level="info"
)
# Access stored messages
events = logger.stored_messages["EVENTS"]
Gunicorn Integration
When running under Gunicorn, LifecycleLogging automatically detects and inherits Gunicorn's logger configuration:
# The logger will automatically use Gunicorn's handlers if available
logger = Logging(
enable_console=True,
enable_file=True
)
Development
# Install development dependencies
pip install -e ".[dev,test,docs]"
# Run tests
make test
# Run linting and type checks
make check
# Build documentation
make docs
License
MIT License - See LICENSE for details.
Happy Logging!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lifecyclelogging-2025.11.143.tar.gz.
File metadata
- Download URL: lifecyclelogging-2025.11.143.tar.gz
- Upload date:
- Size: 708.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6ab389af449268286152b6ba41071a3d67853e42c9e1ea26129224f92eb3879
|
|
| MD5 |
80b8d182b4ac48a3b4e07c40591ebfd4
|
|
| BLAKE2b-256 |
4358d8be4354c9c732271b88cbf0e89440210a4decafe42cf0fdadd7cd592faa
|
Provenance
The following attestation bundles were made for lifecyclelogging-2025.11.143.tar.gz:
Publisher:
ci.yml on jbcom/lifecyclelogging
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lifecyclelogging-2025.11.143.tar.gz -
Subject digest:
c6ab389af449268286152b6ba41071a3d67853e42c9e1ea26129224f92eb3879 - Sigstore transparency entry: 726610910
- Sigstore integration time:
-
Permalink:
jbcom/lifecyclelogging@9e497d62b7ceb795df2314e75c3cca026676be9a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jbcom
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@9e497d62b7ceb795df2314e75c3cca026676be9a -
Trigger Event:
push
-
Statement type:
File details
Details for the file lifecyclelogging-2025.11.143-py3-none-any.whl.
File metadata
- Download URL: lifecyclelogging-2025.11.143-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b07b010fd92d27a91e0b17d67707e55776a1de61e461e02af420580a32f2c7b5
|
|
| MD5 |
8c6c8da311f16dbe63997b56fced1987
|
|
| BLAKE2b-256 |
76ebc7189ccd63eb0ce843d35071fee0bf762db803bfe460d763f2796b403dcc
|
Provenance
The following attestation bundles were made for lifecyclelogging-2025.11.143-py3-none-any.whl:
Publisher:
ci.yml on jbcom/lifecyclelogging
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
lifecyclelogging-2025.11.143-py3-none-any.whl -
Subject digest:
b07b010fd92d27a91e0b17d67707e55776a1de61e461e02af420580a32f2c7b5 - Sigstore transparency entry: 726610917
- Sigstore integration time:
-
Permalink:
jbcom/lifecyclelogging@9e497d62b7ceb795df2314e75c3cca026676be9a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jbcom
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@9e497d62b7ceb795df2314e75c3cca026676be9a -
Trigger Event:
push
-
Statement type: