Skip to main content

A comprehensive logging utility for managing application lifecycle logs

Project description

LifecycleLogging

LifecycleLogging Logo

A comprehensive logging utility for managing application lifecycle logs, combining the power of Python's logging with rich output formatting.

Documentation GitHub

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
  • JSON data attachment support
  • Type-safe implementation
  • Seamless integration with existing logging systems
  • Automatic Gunicorn logger integration

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"
)

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lifecyclelogging-0.1.2.tar.gz (703.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lifecyclelogging-0.1.2-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file lifecyclelogging-0.1.2.tar.gz.

File metadata

  • Download URL: lifecyclelogging-0.1.2.tar.gz
  • Upload date:
  • Size: 703.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for lifecyclelogging-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e3c8b28094d8e9e2752481181cc0c57e2efbaedab2cfe719de05602d7db5a852
MD5 70367a7d3e2fc9067ff275bede5e3f5f
BLAKE2b-256 3bb3f394a520e52b5c30b7526c24b26de7027f7b0a69479464230c7d62236424

See more details on using hashes here.

Provenance

The following attestation bundles were made for lifecyclelogging-0.1.2.tar.gz:

Publisher: release.yml on jbcom/lifecyclelogging

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lifecyclelogging-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for lifecyclelogging-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 55386aea53d9bc70fe60e014d3f6b2bb1d02ab12a5028b3b5fbcc70b10ce5fb4
MD5 439990637c52e12d6e0dfc5285f6a536
BLAKE2b-256 83c4d2f1edb2a9927c885fab818ec453d8dd49ffad09dc7736125b81a41f2038

See more details on using hashes here.

Provenance

The following attestation bundles were made for lifecyclelogging-0.1.2-py3-none-any.whl:

Publisher: release.yml on jbcom/lifecyclelogging

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page