"""Logger.""" import uuid from owslogger import logger from lambdacommon.util import setup_ows_logger from config import SCRIPT_NAME from config import ENVIRONMENT from config import LOGGER_LEVEL app_logger = setup_ows_logger( ENVIRONMENT, SCRIPT_NAME, LOGGER_LEVEL, SCRIPT_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() })