[Asterisk-cvs] asterisk logger.c,1.35,1.36
markster at lists.digium.com
markster at lists.digium.com
Tue May 18 01:35:23 CDT 2004
Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv14359
Modified Files:
logger.c
Log Message:
Add date formatting capability for logger (bug #1665)
Index: logger.c
===================================================================
RCS file: /usr/cvsroot/asterisk/logger.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- logger.c 6 May 2004 20:23:48 -0000 1.35
+++ logger.c 18 May 2004 05:47:27 -0000 1.36
@@ -48,6 +48,7 @@
#define MAX_MSG_QUEUE 200
+static char dateformat[256] = "%b %e %T"; /* Original Asterisk Format */
static ast_mutex_t msglist_lock = AST_MUTEX_INITIALIZER;
static ast_mutex_t loglock = AST_MUTEX_INITIALIZER;
static int pending_logger_reload = 0;
@@ -186,6 +187,7 @@
struct logchannel *chan, *cur;
struct ast_config *cfg;
struct ast_variable *var;
+ char *s;
/* delete our list of log channels */
ast_mutex_lock(&loglock);
@@ -208,6 +210,9 @@
return;
ast_mutex_lock(&loglock);
+ if ((s = ast_variable_retrieve(cfg, "general", "dateformat"))) {
+ (void)strncpy(dateformat,s,sizeof(dateformat));
+ }
var = ast_variable_browse(cfg, "logfiles");
while(var) {
chan = make_logchannel(var->name, var->value, var->lineno);
@@ -466,7 +471,7 @@
time(&t);
localtime_r(&t, &tm);
- strftime(date, sizeof(date), "%b %e %T", &tm);
+ strftime(date, sizeof(date), dateformat, &tm);
if (level == __LOG_EVENT) {
More information about the svn-commits
mailing list