diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2020-12-11 16:58:20 +0100 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2020-12-15 00:52:51 +0100 |
| commit | 0af437949dd002a0f0021f35f20681e653e1f849 (patch) | |
| tree | 5b3ae241fade40805a4d78e65204c2c2f728fb44 /src | |
| parent | 8b1ef9504d0bcfbd8433df943e307bbd1aa30c4f (diff) | |
| download | PROJ-0af437949dd002a0f0021f35f20681e653e1f849.tar.gz PROJ-0af437949dd002a0f0021f35f20681e653e1f849.zip | |
Move proj_log_XXX() functions from internal.cpp to log.cpp
Diffstat (limited to 'src')
| -rw-r--r-- | src/internal.cpp | 83 | ||||
| -rw-r--r-- | src/log.cpp | 79 |
2 files changed, 79 insertions, 83 deletions
diff --git a/src/internal.cpp b/src/internal.cpp index 175ffa9b..9cc48120 100644 --- a/src/internal.cpp +++ b/src/internal.cpp @@ -416,86 +416,3 @@ to that context. return; errno = err; } - -/* logging */ - -/* pj_vlog resides in pj_log.c and relates to pj_log as vsprintf relates to sprintf */ -void pj_vlog( PJ_CONTEXT *ctx, int level, const char *fmt, va_list args ); - - -/***************************************************************************************/ -PJ_LOG_LEVEL proj_log_level (PJ_CONTEXT *ctx, PJ_LOG_LEVEL log_level) { -/**************************************************************************************** - Set logging level 0-3. Higher number means more debug info. 0 turns it off -****************************************************************************************/ - PJ_LOG_LEVEL previous; - if (nullptr==ctx) - ctx = pj_get_default_ctx(); - if (nullptr==ctx) - return PJ_LOG_TELL; - previous = static_cast<PJ_LOG_LEVEL>(abs (ctx->debug_level)); - if (PJ_LOG_TELL==log_level) - return previous; - ctx->debug_level = log_level; - return previous; -} - - -/*****************************************************************************/ -void proj_log_error (PJ *P, const char *fmt, ...) { -/****************************************************************************** - For reporting the most severe events. -******************************************************************************/ - va_list args; - va_start( args, fmt ); - pj_vlog (pj_get_ctx (P), PJ_LOG_ERROR , fmt, args); - va_end( args ); -} - - -/*****************************************************************************/ -void proj_log_debug (PJ *P, const char *fmt, ...) { -/****************************************************************************** - For reporting debugging information. -******************************************************************************/ - va_list args; - va_start( args, fmt ); - pj_vlog (pj_get_ctx (P), PJ_LOG_DEBUG_MAJOR , fmt, args); - 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, ...) { -/****************************************************************************** - For reporting embarrassingly detailed debugging information. -******************************************************************************/ - va_list args; - va_start( args, fmt ); - pj_vlog (pj_get_ctx (P), PJ_LOG_DEBUG_MINOR , fmt, args); - va_end( args ); -} - - -/*****************************************************************************/ -void proj_log_func (PJ_CONTEXT *ctx, void *app_data, PJ_LOG_FUNCTION logf) { -/****************************************************************************** - Put a new logging function into P's context. The opaque object app_data is - passed as first arg at each call to the logger -******************************************************************************/ - if (nullptr==ctx) - ctx = pj_get_default_ctx (); - ctx->logger_app_data = app_data; - if (nullptr!=logf) - ctx->logger = logf; -} diff --git a/src/log.cpp b/src/log.cpp index c343e65b..35e276de 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -96,3 +96,82 @@ void pj_log( PJ_CONTEXT *ctx, int level, const char *fmt, ... ) pj_vlog( ctx, level, fmt, args ); va_end( args ); } + + + +/***************************************************************************************/ +PJ_LOG_LEVEL proj_log_level (PJ_CONTEXT *ctx, PJ_LOG_LEVEL log_level) { +/**************************************************************************************** + Set logging level 0-3. Higher number means more debug info. 0 turns it off +****************************************************************************************/ + PJ_LOG_LEVEL previous; + if (nullptr==ctx) + ctx = pj_get_default_ctx(); + if (nullptr==ctx) + return PJ_LOG_TELL; + previous = static_cast<PJ_LOG_LEVEL>(abs (ctx->debug_level)); + if (PJ_LOG_TELL==log_level) + return previous; + ctx->debug_level = log_level; + return previous; +} + + +/*****************************************************************************/ +void proj_log_error (PJ *P, const char *fmt, ...) { +/****************************************************************************** + For reporting the most severe events. +******************************************************************************/ + va_list args; + va_start( args, fmt ); + pj_vlog (pj_get_ctx (P), PJ_LOG_ERROR , fmt, args); + va_end( args ); +} + + +/*****************************************************************************/ +void proj_log_debug (PJ *P, const char *fmt, ...) { +/****************************************************************************** + For reporting debugging information. +******************************************************************************/ + va_list args; + va_start( args, fmt ); + pj_vlog (pj_get_ctx (P), PJ_LOG_DEBUG_MAJOR , fmt, args); + 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, ...) { +/****************************************************************************** + For reporting embarrassingly detailed debugging information. +******************************************************************************/ + va_list args; + va_start( args, fmt ); + pj_vlog (pj_get_ctx (P), PJ_LOG_DEBUG_MINOR , fmt, args); + va_end( args ); +} + + +/*****************************************************************************/ +void proj_log_func (PJ_CONTEXT *ctx, void *app_data, PJ_LOG_FUNCTION logf) { +/****************************************************************************** + Put a new logging function into P's context. The opaque object app_data is + passed as first arg at each call to the logger +******************************************************************************/ + if (nullptr==ctx) + ctx = pj_get_default_ctx (); + ctx->logger_app_data = app_data; + if (nullptr!=logf) + ctx->logger = logf; +} |
