Metadata-Version: 2.4
Name: lifecyclelogging
Version: 2.1.0
Summary: A comprehensive logging utility for managing application lifecycle logs
Project-URL: Documentation, https://extendeddata.dev
Project-URL: Issues, https://github.com/extended-data-library/extended-data-types/issues
Project-URL: Source, https://github.com/extended-data-library/extended-data-types
Project-URL: Changelog, https://github.com/extended-data-library/extended-data-types/blob/main/packages/lifecyclelogging/CHANGELOG.md
Author-email: Jon Bogaty <jon@jonbogaty.com>
Maintainer-email: Jon Bogaty <jon@jonbogaty.com>
License: MIT
Keywords: debug,lifecycle,logging
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: extended-data-types
Requires-Dist: rich>=13.7.1
Provides-Extra: docs
Requires-Dist: docutils>=0.21.2; extra == 'docs'
Requires-Dist: myst-parser>=3.0.1; extra == 'docs'
Requires-Dist: sphinx-autodoc-typehints>=2.2.0; extra == 'docs'
Requires-Dist: sphinx-autodoc2>=0.5.0; extra == 'docs'
Requires-Dist: sphinx-rtd-theme>=2.0.0; extra == 'docs'
Requires-Dist: sphinx>=7.4.0; extra == 'docs'
Requires-Dist: sphinxawesome-theme>=5.2.0; extra == 'docs'
Provides-Extra: tests
Requires-Dist: coverage[toml]>=7.6.0; extra == 'tests'
Requires-Dist: hypothesis>=6.100.2; extra == 'tests'
Requires-Dist: pytest-cov>=5.0.0; extra == 'tests'
Requires-Dist: pytest-xdist>=3.6.1; extra == 'tests'
Requires-Dist: pytest>=8.2.2; extra == 'tests'
Provides-Extra: typing
Requires-Dist: mypy>=1.10.1; extra == 'typing'
Description-Content-Type: text/markdown

# LifecycleLogging

*Lifecycle-aware logging with rich output and message storage.*

[![CI Status](https://github.com/jbcom/extended-data-library/actions/workflows/ci.yml/badge.svg)](https://github.com/jbcom/extended-data-library/actions/workflows/ci.yml)
[![PyPI version](https://img.shields.io/pypi/v/lifecyclelogging.svg)](https://pypi.org/project/lifecyclelogging/)
[![Python versions](https://img.shields.io/pypi/pyversions/lifecyclelogging.svg)](https://pypi.org/project/lifecyclelogging/)

LifecycleLogging is a comprehensive logging utility that combines Python's `logging` with rich output formatting. It provides configurable console and file outputs, message storage with context markers, verbosity controls, and seamless Gunicorn integration.

## Key Features

- **Rich Formatting** - Enhanced readability with configurable console and file outputs
- **Message Storage** - Store and retrieve messages by context and storage markers
- **Verbosity Control** - Fine-grained verbosity thresholds with bypass markers
- **Level Filtering** - Case-insensitive allowed/denied storage rules
- **JSON Attachment** - Attach structured data to log entries
- **Gunicorn Integration** - Automatic logger inheritance when running under Gunicorn
- **Type-Safe** - Full type annotations throughout

---

## Installation

```bash
pip install lifecyclelogging
```

## Quick Start

```python
from lifecyclelogging import Logging

# Initialize logger
logger = Logging(
    enable_console=True,
    enable_file=True,
    logger_name="my_app"
)

# Basic logging
logger.logged_statement("Basic message", log_level="info")

# With context marker
logger.logged_statement(
    "Application started",
    context_marker="STARTUP",
    log_level="info"
)

# With JSON data
logger.logged_statement(
    "Request received",
    json_data={"method": "GET", "path": "/api/users"},
    log_level="debug"
)
```

## Advanced Features

### Verbosity Control

```python
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

```python
logger.register_verbosity_bypass_marker("IMPORTANT")

# Logged regardless of verbosity settings
logger.logged_statement(
    "Critical info",
    context_marker="IMPORTANT",
    verbose=True,
    verbosity=5,
    log_level="debug"
)
```

### Message Storage

```python
# Store message under a marker
logger.logged_statement(
    "Important event",
    storage_marker="EVENTS",
    log_level="info"
)

# Access stored messages
events = logger.stored_messages["EVENTS"]
```

---

## Contributing

Contributions are welcome! Please see the [Contributing Guidelines](https://github.com/jbcom/extended-data-library/blob/main/CONTRIBUTING.md) for more information.

## Project Links

- [**PyPI**](https://pypi.org/project/lifecyclelogging/)
- [**GitHub**](https://github.com/jbcom/extended-data-library/tree/main/packages/lifecyclelogging)
- [**Documentation**](https://extendeddata.dev)
- [**Changelog**](https://github.com/jbcom/extended-data-library/blob/main/packages/lifecyclelogging/CHANGELOG.md)
