"""Logger.""" import uuid from config import ENVIRONMENT, LAMBDA_NAME, LOGGER_LEVEL from lambdacommon.util import setup_ows_logger from owslogger import logger app_logger = setup_ows_logger( environment=ENVIRONMENT, logger_name=LAMBDA_NAME, logger_level=LOGGER_LEVEL, service_name=LAMBDA_NAME, service_version='1.0.0' ) 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() })