aboutsummaryrefslogtreecommitdiffstats
path: root/main/logger.c
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-27 19:57:36 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-06-27 19:57:36 +0000
commitacb998b38ddd232e7822dec72a1cdc2aec787220 (patch)
tree47b04fb68be6070f5266032e04dd1fb43384cb99 /main/logger.c
parentd69f3f44469d25ba47ee9114c02103576779737d (diff)
Fix -T option. (issue #10073 reported by xylome)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@72233 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/logger.c')
-rw-r--r--main/logger.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/main/logger.c b/main/logger.c
index 5357f9503..1c7ef56a4 100644
--- a/main/logger.c
+++ b/main/logger.c
@@ -992,6 +992,20 @@ void ast_verbose(const char *fmt, ...)
if (!(buf = ast_str_thread_get(&verbose_buf, VERBOSE_BUF_INIT_SIZE)))
return;
+ if (ast_opt_timestamp) {
+ time_t t;
+ struct tm tm;
+ char date[40];
+ char *datefmt;
+
+ time(&t);
+ ast_localtime(&t, &tm, NULL);
+ strftime(date, sizeof(date), dateformat, &tm);
+ datefmt = alloca(strlen(date) + 3 + strlen(fmt) + 1);
+ sprintf(datefmt, "[%s] %s", date, fmt);
+ fmt = datefmt;
+ }
+
/* Build string */
va_start(ap, fmt);
res = ast_str_set_va(&buf, 0, fmt, ap);
@@ -1011,20 +1025,6 @@ void ast_verbose(const char *fmt, ...)
/* Set type */
logmsg->type = LOGMSG_VERBOSE;
- if (ast_opt_timestamp) {
- time_t t;
- struct tm tm;
- char date[40];
- char *datefmt;
-
- time(&t);
- ast_localtime(&t, &tm, NULL);
- strftime(date, sizeof(date), dateformat, &tm);
- datefmt = alloca(strlen(date) + 3 + strlen(fmt) + 1);
- sprintf(datefmt, "[%s] %s", date, fmt);
- fmt = datefmt;
- }
-
/* Add to the list and poke the thread if possible */
if (logthread != AST_PTHREADT_NULL) {
AST_LIST_LOCK(&logmsgs);