summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHerb Lewis <herb@samba.org>2007-03-13 17:39:06 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:18:37 -0500
commit93128b863bb10aeca6202f4d5ba7935e31cf5c5f (patch)
tree768cc05a21503b6c50b0dc1e5c4140f715f5f012
parentaa6055debd078504f6a7ed861443b02672fc9067 (diff)
downloadsamba-93128b863bb10aeca6202f4d5ba7935e31cf5c5f.tar.gz
samba-93128b863bb10aeca6202f4d5ba7935e31cf5c5f.tar.bz2
samba-93128b863bb10aeca6202f4d5ba7935e31cf5c5f.zip
r21825: add debug prefix timestamp to allow "short timestamps" to be
added to debug messages (This used to be commit 4af2795e65f6bab156b300d720c7ea75c944bb87)
-rw-r--r--source3/lib/debug.c10
-rw-r--r--source3/param/loadparm.c4
2 files changed, 12 insertions, 2 deletions
diff --git a/source3/lib/debug.c b/source3/lib/debug.c
index 5f14166110..62fda5741c 100644
--- a/source3/lib/debug.c
+++ b/source3/lib/debug.c
@@ -962,7 +962,7 @@ BOOL dbghdr( int level, const char *file, const char *func, int line )
/* Print the header if timestamps are turned on. If parameters are
* not yet loaded, then default to timestamps on.
*/
- if( lp_timestamp_logs() || !(lp_loaded()) ) {
+ if( lp_timestamp_logs() || lp_debug_prefix_timestamp() || !(lp_loaded()) ) {
char header_str[200];
header_str[0] = '\0';
@@ -980,9 +980,15 @@ BOOL dbghdr( int level, const char *file, const char *func, int line )
}
/* Print it all out at once to prevent split syslog output. */
- (void)Debug1( "[%s, %d%s] %s:%s(%d)\n",
+ if( lp_debug_prefix_timestamp() ) {
+ (void)Debug1( "[%s, %d%s] ",
+ current_timestring(lp_debug_hires_timestamp()), level,
+ header_str);
+ } else {
+ (void)Debug1( "[%s, %d%s] %s:%s(%d)\n",
current_timestring(lp_debug_hires_timestamp()), level,
header_str, file, func, line );
+ }
}
errno = old_errno;
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index b90b53c16b..b9e9505b34 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -290,6 +290,7 @@ typedef struct {
BOOL bClientNTLMv2Auth;
BOOL bClientPlaintextAuth;
BOOL bClientUseSpnego;
+ BOOL bDebugPrefixTimestamp;
BOOL bDebugHiresTimestamp;
BOOL bDebugPid;
BOOL bDebugUid;
@@ -952,6 +953,7 @@ static struct parm_struct parm_table[] = {
{"max log size", P_INTEGER, P_GLOBAL, &Globals.max_log_size, NULL, NULL, FLAG_ADVANCED},
{"debug timestamp", P_BOOL, P_GLOBAL, &Globals.bTimestampLogs, NULL, NULL, FLAG_ADVANCED},
{"timestamp logs", P_BOOL, P_GLOBAL, &Globals.bTimestampLogs, NULL, NULL, FLAG_ADVANCED},
+ {"debug prefix timestamp", P_BOOL, P_GLOBAL, &Globals.bDebugPrefixTimestamp, NULL, NULL, FLAG_ADVANCED},
{"debug hires timestamp", P_BOOL, P_GLOBAL, &Globals.bDebugHiresTimestamp, NULL, NULL, FLAG_ADVANCED},
{"debug pid", P_BOOL, P_GLOBAL, &Globals.bDebugPid, NULL, NULL, FLAG_ADVANCED},
{"debug uid", P_BOOL, P_GLOBAL, &Globals.bDebugUid, NULL, NULL, FLAG_ADVANCED},
@@ -1516,6 +1518,7 @@ static void init_globals(BOOL first_time_only)
Globals.bSyslogOnly = False;
Globals.bTimestampLogs = True;
string_set(&Globals.szLogLevel, "0");
+ Globals.bDebugPrefixTimestamp = False;
Globals.bDebugHiresTimestamp = False;
Globals.bDebugPid = False;
Globals.bDebugUid = False;
@@ -1947,6 +1950,7 @@ FN_GLOBAL_INTEGER(lp_client_schannel, &Globals.clientSchannel)
FN_GLOBAL_INTEGER(lp_server_schannel, &Globals.serverSchannel)
FN_GLOBAL_BOOL(lp_syslog_only, &Globals.bSyslogOnly)
FN_GLOBAL_BOOL(lp_timestamp_logs, &Globals.bTimestampLogs)
+FN_GLOBAL_BOOL(lp_debug_prefix_timestamp, &Globals.bDebugPrefixTimestamp)
FN_GLOBAL_BOOL(lp_debug_hires_timestamp, &Globals.bDebugHiresTimestamp)
FN_GLOBAL_BOOL(lp_debug_pid, &Globals.bDebugPid)
FN_GLOBAL_BOOL(lp_debug_uid, &Globals.bDebugUid)