def wrapper(*args, **kwargs): if current_app.config.get('API_LOG_VERBOSE_DEV_MESSAGES', False): client_warning_msg = "Deprecated endpoint: [{}] {}".format(request.method, request.path) lu.log_api_warning_message_to_browser_console(client_warning_msg) warning_window = current_app.config.get('API_DEPRECATED_ENDPOINT_WARNING_WINDOW', timedelta(weeks=1)) if not dep_removal or datetime.utcnow() >= (dep_removal - warning_window): server_warning_msgs = [ "API client '{}' using deprecated endpoint!".format( request.headers.get('X-App-Host', '<unknown>')), "Deprecation schedule: {} - {}".format( dtu.format_datetime_et(dep_on, "%m/%d/%Y"), dtu.format_datetime_et(dep_removal, "%m/%d/%Y"))] if reason: server_warning_msgs.append("Reason: {}".format(reason)) current_app.logger.warning('\n'.join(server_warning_msgs)) return func(*args, **kwargs)