diff options
| author | Thomas Knudsen <busstoptaktik@users.noreply.github.com> | 2017-11-28 18:34:02 +1300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-11-28 18:34:02 +1300 |
| commit | 1c1d04b45d76366f54e104f9346879fd48bfde8e (patch) | |
| tree | 28b9812adef7549676de8bd48f8c8aa44eb7adfb /src/pj_log.c | |
| parent | 8c6fe8b673c9876e7301d4a890403a931540c17c (diff) | |
| download | PROJ-1c1d04b45d76366f54e104f9346879fd48bfde8e.tar.gz PROJ-1c1d04b45d76366f54e104f9346879fd48bfde8e.zip | |
Enable selective debug printout through negative PROJ_DEBUG values (#689)
* Enable selective debug printout through negative PROJ_DEBUG values
Diffstat (limited to 'src/pj_log.c')
| -rw-r--r-- | src/pj_log.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/pj_log.c b/src/pj_log.c index 2525d050..bab5f078 100644 --- a/src/pj_log.c +++ b/src/pj_log.c @@ -51,8 +51,17 @@ void pj_vlog( projCtx ctx, int level, const char *fmt, va_list args ) { char *msg_buf; + int debug_level = ctx->debug_level; + int shutup_unless_errno_set = debug_level < 0; - if( level > ctx->debug_level ) + /* For negative debug levels, we first start logging when errno is set */ + if (ctx->last_errno==0 && shutup_unless_errno_set) + return; + + if (debug_level < 0) + debug_level = -debug_level; + + if( level > debug_level ) return; msg_buf = (char *) malloc(100000); |
