"""Application Logger. ====================== Creates application logger instance, that will send the logs to Logger. """ import uuid from daemon_asset_copy import config from ddtrace import tracer from owslogger import logger app_logger = logger.setup( config.ENVIRONMENT, config.ENVIRONMENT, config.LOGGER_LEVEL, config.SERVICE_NAME, config.APP_VERSION, ) @tracer.wrap() 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()} )