debug: enable talloc logging
authorAndrew Tridgell <tridge@samba.org>
Fri, 2 Apr 2010 07:19:47 +0000 (18:19 +1100)
committerAndrew Tridgell <tridge@samba.org>
Fri, 2 Apr 2010 07:52:29 +0000 (18:52 +1100)
we want to ensure talloc warnings are printed in the log

lib/util/debug.c
lib/util/debug.h

index 996efdff7e84b9d59e910a08002e4fc541c87625..c8a22149a28baa6ae0dd1fd6c347899e9a132cba 100644 (file)
@@ -182,12 +182,24 @@ _PUBLIC_ void reopen_logs(void)
        }
 }
 
+/* setup for logging of talloc warnings */
+static void talloc_log_fn(const char *msg)
+{
+       DEBUG(0,("%s", msg));
+}
+
+void debug_setup_talloc_log(void)
+{
+       talloc_set_log_fn(talloc_log_fn);
+}
+
 /**
   control the name of the logfile and whether logging will be to stdout, stderr
   or a file
 */
 _PUBLIC_ void setup_logging(const char *prog_name, enum debug_logtype new_logtype)
 {
+       debug_setup_talloc_log();
        if (state.logtype < new_logtype) {
                state.logtype = new_logtype;
        }
index eb2151fc51e2912ff75626b032260ce19fbfdfc6..fd2adcfdedf071850867ce1b06f969ae5f121d52 100644 (file)
@@ -141,4 +141,7 @@ _PUBLIC_ void dbgtext(const char *format, ...) PRINTF_ATTRIBUTE(1,2);
 struct _XFILE;
 extern struct _XFILE *dbf;
 
+/* setup talloc logging */
+void debug_setup_talloc_log(void);
+
 #endif