landregistry-enhanced-logging


Namelandregistry-enhanced-logging JSON
Version 0.9.9 PyPI version JSON
download
home_pageNone
SummaryStandardised logging configuration for HMLR applications
upload_time2024-10-31 13:46:44
maintainerNone
docs_urlNone
authorIan Harvey
requires_python>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Enhanced Logging for HMLR Applications

## Consistent logging for applications

### Features
* Filter that adds the current trace ID to each log record
* Formatter to write each log message in a standard JSON format, compatible
with the [common development environment](https://github.com/LandRegistry/common-dev-env) and STP standard logging configuration.
* Includes the `content_security_policy` logger configuration for the skeleton UI

This package *can* depend on one of:
* Flask and Flask-LogConfig
* Kombu

You should include these dependencies in your `requirements.in` as <thing>, for example:

```
landregistry-enhanced-logging[flask]  # Depend on Flask
landregistry-enhanced-logging[kombu]  # Depend on Kombu
landregistry-enhanced-logging         # No dependencies
```


#### Flask applications
Import `FlaskEnhancedLogging` and initialise it as a Flask extension:

```python
from landregistry.enhanced_logging import FlaskEnhancedLogging
from <somewhere> import app

enhanced_logging = FlaskEnhancedLogging()
enhanced_logging.init_app(app)

# Then just use the default Flask app logger:
app.logger.info('This is a log message')
```

#### Kombu applications
Import `KombuEnhancedLogging` and initialise it:

```python
from landregistry.enhanced_logging import KombuEnhancedLogging

logger_ext = KombuEnhancedLogging()
logger = logger_ext.get_logger()
logger_ext.init(LOG_LEVEL, KOMBU_LOG_LEVEL)

logger.info('This is a log message')
```

The `KombuEnhancedLogging` constructor takes an optional `app_module_name` parameter used to name the logger with a
default value of `server`.


#### Other applications
Import `EnhancedLogging` and initialise it:

```python
from landregistry.enhanced_logging import EnhancedLogging

extension = EnhancedLogging()
logger = extension.logger
extension.init(LOG_LEVEL)

logger.info("This is a log message")
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "landregistry-enhanced-logging",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Ian Harvey",
    "author_email": "ian.harvey@landregistry.gov.uk",
    "download_url": "https://files.pythonhosted.org/packages/08/9a/5b70a0d044604b155bba4a51e39865bb503b74f70e5459893f58fa980789/landregistry_enhanced_logging-0.9.9.tar.gz",
    "platform": null,
    "description": "# Enhanced Logging for HMLR Applications\n\n## Consistent logging for applications\n\n### Features\n* Filter that adds the current trace ID to each log record\n* Formatter to write each log message in a standard JSON format, compatible\nwith the [common development environment](https://github.com/LandRegistry/common-dev-env) and STP standard logging configuration.\n* Includes the `content_security_policy` logger configuration for the skeleton UI\n\nThis package *can* depend on one of:\n* Flask and Flask-LogConfig\n* Kombu\n\nYou should include these dependencies in your `requirements.in` as <thing>, for example:\n\n```\nlandregistry-enhanced-logging[flask]  # Depend on Flask\nlandregistry-enhanced-logging[kombu]  # Depend on Kombu\nlandregistry-enhanced-logging         # No dependencies\n```\n\n\n#### Flask applications\nImport `FlaskEnhancedLogging` and initialise it as a Flask extension:\n\n```python\nfrom landregistry.enhanced_logging import FlaskEnhancedLogging\nfrom <somewhere> import app\n\nenhanced_logging = FlaskEnhancedLogging()\nenhanced_logging.init_app(app)\n\n# Then just use the default Flask app logger:\napp.logger.info('This is a log message')\n```\n\n#### Kombu applications\nImport `KombuEnhancedLogging` and initialise it:\n\n```python\nfrom landregistry.enhanced_logging import KombuEnhancedLogging\n\nlogger_ext = KombuEnhancedLogging()\nlogger = logger_ext.get_logger()\nlogger_ext.init(LOG_LEVEL, KOMBU_LOG_LEVEL)\n\nlogger.info('This is a log message')\n```\n\nThe `KombuEnhancedLogging` constructor takes an optional `app_module_name` parameter used to name the logger with a\ndefault value of `server`.\n\n\n#### Other applications\nImport `EnhancedLogging` and initialise it:\n\n```python\nfrom landregistry.enhanced_logging import EnhancedLogging\n\nextension = EnhancedLogging()\nlogger = extension.logger\nextension.init(LOG_LEVEL)\n\nlogger.info(\"This is a log message\")\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Standardised logging configuration for HMLR applications",
    "version": "0.9.9",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "02b5e36aeb2eeea143969e3fcb9c811092b0b4a880ea51adca2dac14ff106f7c",
                "md5": "f92a8c3b24f948e9e08a47723a9a4205",
                "sha256": "27df27f1473c904655748ed0658d60097090ae338c5140b06242242a0b2c0aae"
            },
            "downloads": -1,
            "filename": "landregistry_enhanced_logging-0.9.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f92a8c3b24f948e9e08a47723a9a4205",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 7616,
            "upload_time": "2024-10-31T13:46:41",
            "upload_time_iso_8601": "2024-10-31T13:46:41.909989Z",
            "url": "https://files.pythonhosted.org/packages/02/b5/e36aeb2eeea143969e3fcb9c811092b0b4a880ea51adca2dac14ff106f7c/landregistry_enhanced_logging-0.9.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "089a5b70a0d044604b155bba4a51e39865bb503b74f70e5459893f58fa980789",
                "md5": "a8ad26239992e5b1ca555a255dc64cbb",
                "sha256": "7c9832aa616c935935d24bbb630d33cad814906e4fa175276df4fa76b5a56253"
            },
            "downloads": -1,
            "filename": "landregistry_enhanced_logging-0.9.9.tar.gz",
            "has_sig": false,
            "md5_digest": "a8ad26239992e5b1ca555a255dc64cbb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 5567,
            "upload_time": "2024-10-31T13:46:44",
            "upload_time_iso_8601": "2024-10-31T13:46:44.172413Z",
            "url": "https://files.pythonhosted.org/packages/08/9a/5b70a0d044604b155bba4a51e39865bb503b74f70e5459893f58fa980789/landregistry_enhanced_logging-0.9.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-31 13:46:44",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "landregistry-enhanced-logging"
}
        
Elapsed time: 0.36597s