lifecyclelogging


Namelifecyclelogging JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryA comprehensive logging utility for managing application lifecycle logs
upload_time2025-01-25 20:16:41
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords debug lifecycle logging
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # LifecycleLogging

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

## Installation

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

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

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

### 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"]
```

### Gunicorn Integration

When running under Gunicorn, LifecycleLogging automatically detects and inherits Gunicorn's logger configuration:

```python
# The logger will automatically use Gunicorn's handlers if available
logger = Logging(
    enable_console=True,
    enable_file=True
)
```

## Development

```bash
# Install development dependencies
pip install -e ".[dev,test,docs]"

# Run tests
make test

# Run linting and type checks
make check

# Build documentation
make docs
```

## Documentation

Full documentation is available in the [docs](docs/) directory.

## License

MIT License - see [LICENSE](LICENSE) for details.

---

**Happy Logging!**

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "lifecyclelogging",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Jon Bogaty <jon@jonbogaty.com>",
    "keywords": "debug, lifecycle, logging",
    "author": null,
    "author_email": "Jon Bogaty <jon@jonbogaty.com>",
    "download_url": "https://files.pythonhosted.org/packages/cb/4d/32b3564e95f14e086c3be90f225629ab9d05e046bbf438df22abcce5b6c8/lifecyclelogging-0.1.0.tar.gz",
    "platform": null,
    "description": "# LifecycleLogging\n\nA comprehensive logging utility for managing application lifecycle logs, combining the power of Python's `logging` with rich output formatting.\n\n## Installation\n\n```bash\npip install lifecyclelogging\n```\n\n## Features\n\n- Configurable console and file logging outputs\n- Rich formatting for enhanced readability\n- Message storage with context and storage markers\n- Verbosity controls with bypass markers\n- JSON data attachment support\n- Type-safe implementation\n- Seamless integration with existing logging systems\n- Automatic Gunicorn logger integration\n\n## Basic Usage\n\n```python\nfrom lifecyclelogging import Logging\n\n# Initialize logger\nlogger = Logging(\n    enable_console=True,  # Enable console output\n    enable_file=True,     # Enable file output\n    logger_name=\"my_app\"\n)\n\n# Basic logging\nlogger.logged_statement(\"Basic message\", log_level=\"info\")\n\n# With context marker\nlogger.logged_statement(\n    \"Message with context\",\n    context_marker=\"STARTUP\",\n    log_level=\"info\"\n)\n\n# With JSON data\nlogger.logged_statement(\n    \"Message with data\",\n    json_data={\"key\": \"value\"},\n    log_level=\"debug\"\n)\n```\n\n## Advanced Features\n\n### Verbosity Control\n\n```python\nlogger = Logging(\n    enable_verbose_output=True,\n    verbosity_threshold=2\n)\n\n# Only logged if verbosity threshold allows\nlogger.logged_statement(\n    \"Detailed debug info\",\n    verbose=True,\n    verbosity=2,\n    log_level=\"debug\"\n)\n```\n\n### Message Storage\n\n```python\n# Store message under a marker\nlogger.logged_statement(\n    \"Important event\",\n    storage_marker=\"EVENTS\",\n    log_level=\"info\"\n)\n\n# Access stored messages\nevents = logger.stored_messages[\"EVENTS\"]\n```\n\n### Gunicorn Integration\n\nWhen running under Gunicorn, LifecycleLogging automatically detects and inherits Gunicorn's logger configuration:\n\n```python\n# The logger will automatically use Gunicorn's handlers if available\nlogger = Logging(\n    enable_console=True,\n    enable_file=True\n)\n```\n\n## Development\n\n```bash\n# Install development dependencies\npip install -e \".[dev,test,docs]\"\n\n# Run tests\nmake test\n\n# Run linting and type checks\nmake check\n\n# Build documentation\nmake docs\n```\n\n## Documentation\n\nFull documentation is available in the [docs](docs/) directory.\n\n## License\n\nMIT License - see [LICENSE](LICENSE) for details.\n\n---\n\n**Happy Logging!**\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A comprehensive logging utility for managing application lifecycle logs",
    "version": "0.1.0",
    "project_urls": {
        "Documentation": "https://github.com/user/lifecyclelogging#readme",
        "Issues": "https://github.com/user/lifecyclelogging/issues",
        "Source": "https://github.com/user/lifecyclelogging"
    },
    "split_keywords": [
        "debug",
        " lifecycle",
        " logging"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "d2a15efb5caa28e3f34530c66cab6b88cc6a688dc3c5ea6497f0b0384cbe595a",
                "md5": "cb95055c2b3b8075a21b382f107e5501",
                "sha256": "69dd96803559749e616ce65029963fff245e9428a104298f1f1bda0d8fb8dd79"
            },
            "downloads": -1,
            "filename": "lifecyclelogging-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cb95055c2b3b8075a21b382f107e5501",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 9926,
            "upload_time": "2025-01-25T20:16:40",
            "upload_time_iso_8601": "2025-01-25T20:16:40.101335Z",
            "url": "https://files.pythonhosted.org/packages/d2/a1/5efb5caa28e3f34530c66cab6b88cc6a688dc3c5ea6497f0b0384cbe595a/lifecyclelogging-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "cb4d32b3564e95f14e086c3be90f225629ab9d05e046bbf438df22abcce5b6c8",
                "md5": "906197da3278e507b89ee7a6605fc286",
                "sha256": "ec6f2dcd1a74f6517f349a6674cf4acbdeb5f083bb9ddda595c45552921c1d15"
            },
            "downloads": -1,
            "filename": "lifecyclelogging-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "906197da3278e507b89ee7a6605fc286",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 20302,
            "upload_time": "2025-01-25T20:16:41",
            "upload_time_iso_8601": "2025-01-25T20:16:41.363004Z",
            "url": "https://files.pythonhosted.org/packages/cb/4d/32b3564e95f14e086c3be90f225629ab9d05e046bbf438df22abcce5b6c8/lifecyclelogging-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-25 20:16:41",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "user",
    "github_project": "lifecyclelogging#readme",
    "github_not_found": true,
    "lcname": "lifecyclelogging"
}
        
Elapsed time: 1.15409s