"""The Orchard logger.""" import uuid from owslogger import logger from neo4j_sync_dlq import config # application logger app_logger = logger.setup( config.LOGGER_DSN, config.ENVIRONMENT, 'ows1', config.LOGGER_LEVEL, config.APPLICATION_NAME, config.APPLICATION_VERSION) def get_current_logger(correlation_id=None): """Get logger with a correlation_id attached. Args: correlation_id: correlation_id that will be sent along with log record Returns: logger.OwsLoggingAdapter: instance of OwsLoggingAdapter with correlation_id attached. """ return logger.OwsLoggingAdapter(app_logger, { 'correlation_id': correlation_id or uuid.uuid4() })