r12799: print out function and location too
authorStefan Metzmacher <metze@samba.org>
Mon, 9 Jan 2006 20:30:44 +0000 (20:30 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:49:57 +0000 (13:49 -0500)
metze

source/include/debug.h
source/lib/debug.c

index eaf53bad6af7425db9953f13a4ac0434df1db741..d92232c645dab63c008ea993566dbd41d12800ba 100644 (file)
@@ -35,7 +35,7 @@ struct debug_ops {
        void (*log_task_id)(int fd);
 };
 
-void do_debug_header(int level);
+void do_debug_header(int level, const char *location, const char *func);
 void do_debug(const char *, ...) PRINTF_ATTRIBUTE(1,2);
 
 extern int DEBUGLEVEL;
@@ -44,7 +44,7 @@ extern int DEBUGLEVEL;
 #define _DEBUG(level, body, header) do { \
        if (DEBUGLVL(level)) { \
                if (header) { \
-                       do_debug_header(level); \
+                       do_debug_header(level, __location__, __FUNCTION__); \
                } \
                do_debug body; \
        } \
index d0288f7ddc25d1e7e0b6985abfa5168e778f0268..9df6e573b0921919589d25819c075cb9f2068a7b 100644 (file)
@@ -45,9 +45,9 @@ static struct {
   the backend for debug messages. Note that the DEBUG() macro has already
   ensured that the log level has been met before this is called
 */
-void do_debug_header(int level)
+void do_debug_header(int level, const char *location, const char *func)
 {
-       log_timestring(level);
+       log_timestring(level, location, func);
        log_task_id();
 }
 
@@ -162,7 +162,7 @@ void print_suspicious_usage(const char* from, const char* info)
        }
 }
 
-void log_timestring(int level)
+void log_timestring(int level, const char *location, const char *func)
 {
        char *t = NULL;
        char *s = NULL;
@@ -172,7 +172,7 @@ void log_timestring(int level)
        t = timestring(NULL, time(NULL));
        if (!t) return;
 
-       asprintf(&s, "[%s, %d]\n", t, level);
+       asprintf(&s, "[%s, %d %s:%s()]\n", t, level, location, func);
        talloc_free(t);
        if (!s) return;