13
13
#include <errno.h>
14
14
15
15
#include "zlog.h"
16
+ #include "fpm.h"
16
17
17
18
#define MAX_LINE_LENGTH 1024
18
19
@@ -47,7 +48,7 @@ size_t zlog_print_time(struct timeval *tv, char *timebuf, size_t timebuf_len) /*
47
48
if (zlog_level == ZLOG_DEBUG ) {
48
49
len += snprintf (timebuf + len , timebuf_len - len , ".%06d" , (int ) tv -> tv_usec );
49
50
}
50
- len += snprintf (timebuf + len , timebuf_len - len , "]" );
51
+ len += snprintf (timebuf + len , timebuf_len - len , "] " );
51
52
return len ;
52
53
}
53
54
/* }}} */
@@ -78,7 +79,7 @@ void zlog_ex(const char *function, int line, int flags, const char *fmt, ...) /*
78
79
char buf [MAX_LINE_LENGTH ];
79
80
const size_t buf_size = MAX_LINE_LENGTH ;
80
81
va_list args ;
81
- size_t len ;
82
+ size_t len = 0 ;
82
83
int truncated = 0 ;
83
84
int saved_errno ;
84
85
@@ -87,12 +88,14 @@ void zlog_ex(const char *function, int line, int flags, const char *fmt, ...) /*
87
88
}
88
89
89
90
saved_errno = errno ;
90
- gettimeofday (& tv , 0 );
91
- len = zlog_print_time (& tv , buf , buf_size );
91
+ if (!fpm_globals .is_child ) {
92
+ gettimeofday (& tv , 0 );
93
+ len = zlog_print_time (& tv , buf , buf_size );
94
+ }
92
95
if (zlog_level == ZLOG_DEBUG ) {
93
- len += snprintf (buf + len , buf_size - len , " %s: pid %d, %s(), line %d: " , level_names [flags & ZLOG_LEVEL_MASK ], getpid (), function , line );
96
+ len += snprintf (buf + len , buf_size - len , "%s: pid %d, %s(), line %d: " , level_names [flags & ZLOG_LEVEL_MASK ], getpid (), function , line );
94
97
} else {
95
- len += snprintf (buf + len , buf_size - len , " %s: " , level_names [flags & ZLOG_LEVEL_MASK ]);
98
+ len += snprintf (buf + len , buf_size - len , "%s: " , level_names [flags & ZLOG_LEVEL_MASK ]);
96
99
}
97
100
98
101
if (len > buf_size - 1 ) {
0 commit comments