aboutsummaryrefslogtreecommitdiff
path: root/src/log.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2021-07-23 10:12:53 +0200
committerGitHub <noreply@github.com>2021-07-23 10:12:53 +0200
commitd8b85102bcd1bdd3a93e0bf240b164fddb89b3c5 (patch)
tree5d94e3f7e1c5570466d88712bd8946570616785a /src/log.cpp
parent3b4f53a409492ec414bab8e3dba073cd7bc7fcf3 (diff)
parent80dddb675276ec1cb28525e481c0c6bedb886145 (diff)
downloadPROJ-d8b85102bcd1bdd3a93e0bf240b164fddb89b3c5.tar.gz
PROJ-d8b85102bcd1bdd3a93e0bf240b164fddb89b3c5.zip
Merge pull request #2788 from OSGeo/backport-2787-to-8.1
[Backport 8.1] GeoTIFF grid reading: perf improvements (fixes #2785)
Diffstat (limited to 'src/log.cpp')
-rw-r--r--src/log.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/log.cpp b/src/log.cpp
index 4a2cc73d..9c96f53a 100644
--- a/src/log.cpp
+++ b/src/log.cpp
@@ -46,25 +46,36 @@ void pj_stderr_logger( void *app_data, int level, const char *msg )
}
/************************************************************************/
-/* pj_vlog() */
+/* pj_log_active() */
/************************************************************************/
-static
-void pj_vlog( PJ_CONTEXT *ctx, int level, const PJ* P, const char *fmt, va_list args )
-
+bool pj_log_active( PJ_CONTEXT *ctx, int level )
{
- char *msg_buf;
int debug_level = ctx->debug_level;
int shutup_unless_errno_set = debug_level < 0;
/* For negative debug levels, we first start logging when errno is set */
if (ctx->last_errno==0 && shutup_unless_errno_set)
- return;
+ return false;
if (debug_level < 0)
debug_level = -debug_level;
if( level > debug_level )
+ return false;
+ return true;
+}
+
+/************************************************************************/
+/* pj_vlog() */
+/************************************************************************/
+
+static
+void pj_vlog( PJ_CONTEXT *ctx, int level, const PJ* P, const char *fmt, va_list args )
+
+{
+ char *msg_buf;
+ if( !pj_log_active(ctx, level) )
return;
constexpr size_t BUF_SIZE = 100000;