Skip to main content

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_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 , 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

landregistry_enhanced_logging-0.9.9.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file landregistry_enhanced_logging-0.9.9.tar.gz.

File metadata

File hashes

Hashes for landregistry_enhanced_logging-0.9.9.tar.gz
Algorithm Hash digest
SHA256 7c9832aa616c935935d24bbb630d33cad814906e4fa175276df4fa76b5a56253
MD5 a8ad26239992e5b1ca555a255dc64cbb
BLAKE2b-256 089a5b70a0d044604b155bba4a51e39865bb503b74f70e5459893f58fa980789

See more details on using hashes here.

File details

Details for the file landregistry_enhanced_logging-0.9.9-py3-none-any.whl.

File metadata

File hashes

Hashes for landregistry_enhanced_logging-0.9.9-py3-none-any.whl
Algorithm Hash digest
SHA256 27df27f1473c904655748ed0658d60097090ae338c5140b06242242a0b2c0aae
MD5 f92a8c3b24f948e9e08a47723a9a4205
BLAKE2b-256 02b5e36aeb2eeea143969e3fcb9c811092b0b4a880ea51adca2dac14ff106f7c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page