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")
Metadata
Release files for landregistry-enhanced-logging 0.9.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| landregistry_enhanced_logging-0.9.9.tar.gz | 5.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| landregistry_enhanced_logging-0.9.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.2 kB
Release files / landregistry_enhanced_logging-0.9.9.tar.gz
| Download URL | landregistry_enhanced_logging-0.9.9.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7c9832aa616c935935d24bbb630d33cad814906e4fa175276df4fa76b5a56253
|
|
BLAKE2b-256 checksum How to use checksums |
089a5b70a0d044604b155bba4a51e39865bb503b74f70e5459893f58fa980789
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.12
|
Release files / landregistry_enhanced_logging-0.9.9-py3-none-any.whl
| Download URL | landregistry_enhanced_logging-0.9.9-py3-none-any.whl |
|---|---|
| Size | 7.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
27df27f1473c904655748ed0658d60097090ae338c5140b06242242a0b2c0aae
|
|
BLAKE2b-256 checksum How to use checksums |
02b5e36aeb2eeea143969e3fcb9c811092b0b4a880ea51adca2dac14ff106f7c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.12
|