From d669631ad36641e49fca9e96a4bdd5e590efa239 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Thu, 27 Dec 2018 19:38:52 +0100 Subject: proj_create_crs_to_crs(): add debugging traces --- src/4D_api.cpp | 4 ++++ src/internal.cpp | 10 ++++++++++ src/proj_internal.h | 2 ++ 3 files changed, 16 insertions(+) (limited to 'src') diff --git a/src/4D_api.cpp b/src/4D_api.cpp index 88210348..de950c7a 100644 --- a/src/4D_api.cpp +++ b/src/4D_api.cpp @@ -757,11 +757,13 @@ PJ *proj_create_crs_to_crs (PJ_CONTEXT *ctx, const char *source_crs, const char src = proj_obj_create_from_user_input(ctx, source_crs, optionsImportCRS); if( !src ) { + proj_context_log_debug(ctx, "Cannot instanciate source_crs"); return nullptr; } dst = proj_obj_create_from_user_input(ctx, target_crs, optionsImportCRS); if( !dst ) { + proj_context_log_debug(ctx, "Cannot instanciate target_crs"); proj_obj_destroy(src); return nullptr; } @@ -798,6 +800,7 @@ PJ *proj_create_crs_to_crs (PJ_CONTEXT *ctx, const char *source_crs, const char if( proj_obj_list_get_count(op_list) == 0 ) { proj_obj_list_destroy(op_list); + proj_context_log_debug(ctx, "No operation found matching criteria"); return nullptr; } @@ -810,6 +813,7 @@ PJ *proj_create_crs_to_crs (PJ_CONTEXT *ctx, const char *source_crs, const char proj_string = proj_obj_as_proj_string(ctx, op, PJ_PROJ_5, nullptr); if( !proj_string) { proj_obj_destroy(op); + proj_context_log_debug(ctx, "Cannot export operation as a PROJ string"); return nullptr; } diff --git a/src/internal.cpp b/src/internal.cpp index 3f3d191e..41744d16 100644 --- a/src/internal.cpp +++ b/src/internal.cpp @@ -416,6 +416,16 @@ void proj_log_debug (PJ *P, const char *fmt, ...) { va_end( args ); } +/*****************************************************************************/ +void proj_context_log_debug (PJ_CONTEXT *ctx, const char *fmt, ...) { +/****************************************************************************** + For reporting debugging information. +******************************************************************************/ + va_list args; + va_start( args, fmt ); + pj_vlog (ctx, PJ_LOG_DEBUG_MAJOR , fmt, args); + va_end( args ); +} /*****************************************************************************/ void proj_log_trace (PJ *P, const char *fmt, ...) { diff --git a/src/proj_internal.h b/src/proj_internal.h index d5154f78..e0999d88 100644 --- a/src/proj_internal.h +++ b/src/proj_internal.h @@ -111,6 +111,8 @@ void PROJ_DLL proj_log_error (PJ *P, const char *fmt, ...); void proj_log_debug (PJ *P, const char *fmt, ...); void proj_log_trace (PJ *P, const char *fmt, ...); +void proj_context_log_debug (PJ_CONTEXT *ctx, const char *fmt, ...); + int pj_ellipsoid (PJ *); void pj_inherit_ellipsoid_def (const PJ *src, PJ *dst); void pj_erase_ellipsoid_def (PJ *P); -- cgit v1.2.3