[svn-commits] trunk - r7750 in /trunk: configs/manager.conf.sample
manager.c
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Tue Jan 3 16:07:13 CST 2006
Author: kpfleming
Date: Tue Jan 3 16:07:12 2006
New Revision: 7750
URL: http://svn.digium.com/view/asterisk?rev=7750&view=rev
Log:
add optional timestamps to manager events (issue #5535, simplified)
Modified:
trunk/configs/manager.conf.sample
trunk/manager.c
Modified: trunk/configs/manager.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/manager.conf.sample?rev=7750&r1=7749&r2=7750&view=diff
==============================================================================
--- trunk/configs/manager.conf.sample (original)
+++ trunk/configs/manager.conf.sample Tue Jan 3 16:07:12 2006
@@ -20,6 +20,10 @@
port = 5038
bindaddr = 0.0.0.0
;displayconnects = yes
+;
+; Add a Unix epoch timestamp to events (not action responses)
+;
+;timestampevents = yes
;[mark]
;secret = mysecret
Modified: trunk/manager.c
URL: http://svn.digium.com/view/asterisk/trunk/manager.c?rev=7750&r1=7749&r2=7750&view=diff
==============================================================================
--- trunk/manager.c (original)
+++ trunk/manager.c Tue Jan 3 16:07:12 2006
@@ -84,6 +84,7 @@
static int portno = DEFAULT_MANAGER_PORT;
static int asock = -1;
static int displayconnects = 1;
+static int timestampevents = 0;
static pthread_t t;
AST_MUTEX_DEFINE_STATIC(sessionlock);
@@ -1521,8 +1522,15 @@
continue;
if (ast_strlen_zero(tmp)) {
+ struct timeval now;
+
ast_build_string(&tmp_next, &tmp_left, "Event: %s\r\nPrivilege: %s\r\n",
event, authority_to_str(category, auth, sizeof(auth)));
+ if (timestampevents) {
+ now = ast_tvnow();
+ ast_build_string(&tmp_next, &tmp_left, "Timestamp: %ld.%06lu\r\n",
+ now.tv_sec, now.tv_usec);
+ }
va_start(ap, fmt);
ast_build_string_va(&tmp_next, &tmp_left, fmt, ap);
va_end(ap);
@@ -1704,11 +1712,12 @@
}
ast_log(LOG_NOTICE, "Use of portno in manager.conf deprecated. Please use 'port=%s' instead.\n", val);
}
- /* Parsing the displayconnects */
- if ((val = ast_variable_retrieve(cfg, "general", "displayconnects"))) {
- displayconnects = ast_true(val);;
- }
-
+
+ if ((val = ast_variable_retrieve(cfg, "general", "displayconnects")))
+ displayconnects = ast_true(val);
+
+ if ((val = ast_variable_retrieve(cfg, "general", "timestampevents")))
+ timestampevents = ast_true(val);
ba.sin_family = AF_INET;
ba.sin_port = htons(portno);
More information about the svn-commits
mailing list