"""Logger.""" import uuid from owslogger import logger from src.config import ENVIRONMENT from src.config import LAMBDA_NAME from src.config import LOGGER_LEVEL app_logger = logger.setup( ENVIRONMENT, LAMBDA_NAME, LOGGER_LEVEL, LAMBDA_NAME, '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() })