diff --git a/src/iso19111/c_api.cpp b/src/iso19111/c_api.cpp index ae13b40dda..c3e428d21d 100644 --- a/src/iso19111/c_api.cpp +++ b/src/iso19111/c_api.cpp @@ -75,10 +75,12 @@ using namespace NS_PROJ; static void PROJ_NO_INLINE proj_log_error(PJ_CONTEXT *ctx, const char *function, const char *text) { - std::string msg(function); - msg += ": "; - msg += text; - ctx->logger(ctx->logger_app_data, PJ_LOG_ERROR, msg.c_str()); + if (ctx->debug_level != PJ_LOG_NONE) { + std::string msg(function); + msg += ": "; + msg += text; + ctx->logger(ctx->logger_app_data, PJ_LOG_ERROR, msg.c_str()); + } auto previous_errno = proj_context_errno(ctx); if (previous_errno == 0) { // only set errno if it wasn't set deeper down the call stack