[asterisk-commits] alecdavis: trunk r334619 - /trunk/main/logger.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Sep 7 03:06:39 CDT 2011
Author: alecdavis
Date: Wed Sep 7 03:06:32 2011
New Revision: 334619
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=334619
Log:
log Asterisk Version number, Build etc into each log file
Allow tracking of previous versions through log file records to be tracked.
Each time log file is created or opened, log Asterisk Version, Buildinfo. etc.
alecdavis (license 585)
Tested by: alecdavis
Review: https://reviewboard.asterisk.org/r/1409/
Modified:
trunk/main/logger.c
Modified: trunk/main/logger.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/logger.c?view=diff&rev=334619&r1=334618&r2=334619
==============================================================================
--- trunk/main/logger.c (original)
+++ trunk/main/logger.c Wed Sep 7 03:06:32 2011
@@ -48,6 +48,8 @@
#include "asterisk/pbx.h"
#include "asterisk/app.h"
#include "asterisk/syslog.h"
+#include "asterisk/buildinfo.h"
+#include "asterisk/ast_version.h"
#include <signal.h>
#include <time.h>
@@ -235,6 +237,9 @@
{
struct logchannel *chan;
char *facility;
+ struct ast_tm tm;
+ struct timeval now = ast_tvnow();
+ char datestring[256];
if (ast_strlen_zero(channel) || !(chan = ast_calloc(1, sizeof(*chan) + strlen(components) + 1)))
return NULL;
@@ -283,6 +288,15 @@
ast_console_puts_mutable("'\n", __LOG_ERROR);
ast_free(chan);
return NULL;
+ } else {
+ /* Create our date/time */
+ ast_localtime(&now, &tm, NULL);
+ ast_strftime(datestring, sizeof(datestring), dateformat, &tm);
+
+ fprintf(chan->fileptr, "[%s] Asterisk %s built by %s @ %s on a %s running %s on %s\n",
+ datestring, ast_get_version(), ast_build_user, ast_build_hostname,
+ ast_build_machine, ast_build_os, ast_build_date);
+ fflush(chan->fileptr);
}
chan->type = LOGTYPE_FILE;
}
More information about the asterisk-commits
mailing list