[asterisk-commits] file: trunk r72233 - /trunk/main/logger.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jun 27 14:57:37 CDT 2007
Author: file
Date: Wed Jun 27 14:57:36 2007
New Revision: 72233
URL: http://svn.digium.com/view/asterisk?view=rev&rev=72233
Log:
Fix -T option. (issue #10073 reported by xylome)
Modified:
trunk/main/logger.c
Modified: trunk/main/logger.c
URL: http://svn.digium.com/view/asterisk/trunk/main/logger.c?view=diff&rev=72233&r1=72232&r2=72233
==============================================================================
--- trunk/main/logger.c (original)
+++ trunk/main/logger.c Wed Jun 27 14:57:36 2007
@@ -992,6 +992,20 @@
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 @@
/* 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);
More information about the asterisk-commits
mailing list