diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2017-02-12 16:30:28 +0000 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2017-02-12 16:30:28 +0000 |
commit | 398f9af3b35c79d142dcbfd7b56758eea88c8f43 (patch) | |
tree | 0e7a14be6ee32f2bd0f6859276a7e83e944f9188 /src | |
parent | 852e25c532665a5523f07930030199666aef996c (diff) |
Debug: avoid indenting line-prefixes (timestamp, pid, host-checking marker)
Diffstat (limited to 'src')
-rw-r--r-- | src/src/debug.c | 29 | ||||
-rw-r--r-- | src/src/functions.h | 2 |
2 files changed, 16 insertions, 15 deletions
diff --git a/src/src/debug.c b/src/src/debug.c index 3cd6d0c92..ee284d0be 100644 --- a/src/src/debug.c +++ b/src/src/debug.c @@ -152,33 +152,22 @@ void debug_printf_indent(const char * format, ...) { va_list ap; -unsigned depth = acl_level + expand_level, i; - -if (!debug_file) return; -if (depth > 0) - { - for (i = depth >> 2; i > 0; i--) - fprintf(debug_file, " ."); - fprintf(debug_file, "%*s", depth & 3, ""); - } - va_start(ap, format); -debug_vprintf(format, ap); +debug_vprintf(acl_level + expand_level, format, ap); va_end(ap); } - void debug_printf(const char *format, ...) { va_list ap; va_start(ap, format); -debug_vprintf(format, ap); +debug_vprintf(0, format, ap); va_end(ap); } void -debug_vprintf(const char *format, va_list ap) +debug_vprintf(int indent, const char *format, va_list ap) { int save_errno = errno; @@ -217,6 +206,18 @@ if (debug_ptr == debug_buffer) debug_prefix_length = debug_ptr - debug_buffer; } +if (indent > 0) + { + int i; + for (i = indent >> 2; i > 0; i--) + { + Ustrcpy(debug_ptr, " ."); + debug_ptr += 4; + } + Ustrncpy(debug_ptr, " ", indent & 3); + debug_ptr += indent & 3; + } + /* Use the checked formatting routine to ensure that the buffer does not overflow. Ensure there's space for a newline at the end. */ diff --git a/src/src/functions.h b/src/src/functions.h index a0ab39e17..2ff6017d8 100644 --- a/src/src/functions.h +++ b/src/src/functions.h @@ -135,7 +135,7 @@ extern void debug_print_ids(uschar *); extern void debug_printf_indent(const char *, ...) PRINTF_FUNCTION(1,2); extern void debug_print_string(uschar *); extern void debug_print_tree(tree_node *); -extern void debug_vprintf(const char *, va_list); +extern void debug_vprintf(int, const char *, va_list); extern void decode_bits(unsigned int *, size_t, int *, uschar *, bit_table *, int, uschar *, int); extern address_item *deliver_make_addr(uschar *, BOOL); |