Standardised logging configuration for HMLR applications
Project description
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 and STP standard logging configuration.
- Includes the
content_security_policylogger 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 , 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:
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:
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:
from landregistry.enhanced_logging import EnhancedLogging
extension = EnhancedLogging()
logger = extension.logger
extension.init(LOG_LEVEL)
logger.info("This is a log message")
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 landregistry_enhanced_logging-0.9.9.tar.gz.
File metadata
- Download URL: landregistry_enhanced_logging-0.9.9.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c9832aa616c935935d24bbb630d33cad814906e4fa175276df4fa76b5a56253
|
|
| MD5 |
a8ad26239992e5b1ca555a255dc64cbb
|
|
| BLAKE2b-256 |
089a5b70a0d044604b155bba4a51e39865bb503b74f70e5459893f58fa980789
|
File details
Details for the file landregistry_enhanced_logging-0.9.9-py3-none-any.whl.
File metadata
- Download URL: landregistry_enhanced_logging-0.9.9-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27df27f1473c904655748ed0658d60097090ae338c5140b06242242a0b2c0aae
|
|
| MD5 |
f92a8c3b24f948e9e08a47723a9a4205
|
|
| BLAKE2b-256 |
02b5e36aeb2eeea143969e3fcb9c811092b0b4a880ea51adca2dac14ff106f7c
|