Fix -T option. (issue #10073 reported by xylome)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@72233 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
parent
d69f3f4446
commit
acb998b38d
1 changed files with 14 additions and 14 deletions
|
@ -992,6 +992,20 @@ void ast_verbose(const char *fmt, ...)
|
||||||
if (!(buf = ast_str_thread_get(&verbose_buf, VERBOSE_BUF_INIT_SIZE)))
|
if (!(buf = ast_str_thread_get(&verbose_buf, VERBOSE_BUF_INIT_SIZE)))
|
||||||
return;
|
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 */
|
/* Build string */
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
res = ast_str_set_va(&buf, 0, fmt, ap);
|
res = ast_str_set_va(&buf, 0, fmt, ap);
|
||||||
|
@ -1011,20 +1025,6 @@ void ast_verbose(const char *fmt, ...)
|
||||||
/* Set type */
|
/* Set type */
|
||||||
logmsg->type = LOGMSG_VERBOSE;
|
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 */
|
/* Add to the list and poke the thread if possible */
|
||||||
if (logthread != AST_PTHREADT_NULL) {
|
if (logthread != AST_PTHREADT_NULL) {
|
||||||
AST_LIST_LOCK(&logmsgs);
|
AST_LIST_LOCK(&logmsgs);
|
||||||
|
|
Reference in a new issue