[PATCH] debug: Print header when logging to stdout

Christof Schmitt cs at samba.org
Fri Nov 21 14:52:16 MST 2014

This patch changes the debug code, so that the header is always printed.
I find this useful for debugging interactive commands with -d10. Always
having the debug header in the output would also make the explicit
function name in the debug message obsolete.

I assume that there is a historical reason for the behavior in the debug
code; does anybody know why the debug code behaves differently for
stdout and logging to a file?

-------------- next part --------------
From c3f9fcde891dcfb41468292d99f6ee112c149d6c Mon Sep 17 00:00:00 2001
From: Christof Schmitt <cs at samba.org>
Date: Fri, 21 Nov 2014 14:44:38 -0700
Subject: [PATCH] debug: Print header when logging to stdout

Having the source line of the error messages helps debugging interactive

Signed-off-by: Christof Schmitt <cs at samba.org>
 lib/util/debug.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/lib/util/debug.c b/lib/util/debug.c
index 750ad25..31a203b 100644
--- a/lib/util/debug.c
+++ b/lib/util/debug.c
@@ -969,11 +969,6 @@ bool dbghdrclass(int level, int cls, const char *location, const char *func)
 	/* Set current_msg_level. */
 	current_msg_level = level;
-	/* Don't print a header if we're logging to stdout. */
-	if ( state.logtype != DEBUG_FILE ) {
-		return( true );
-	}
 	/* Print the header if timestamps are turned on.  If parameters are
 	 * not yet loaded, then default to timestamps on.

More information about the samba-technical mailing list