Selaa lähdekoodia

Merge pull request #320 from jitsi/log_collector

Log collector
dev1
hristoterezov 9 vuotta sitten
vanhempi
commit
147060da93

+ 5
- 0
JitsiConferenceEventManager.js Näytä tiedosto

@@ -548,6 +548,11 @@ JitsiConferenceEventManager.prototype.setupStatisticsListeners = function () {
548 548
 
549 549
         conference.rtc.setAudioLevel(resource, level);
550 550
     });
551
+    // Forward the "before stats disposed" event
552
+    conference.statistics.addBeforeDisposedListener(function () {
553
+        conference.eventEmitter.emit(
554
+            JitsiConferenceEvents.BEFORE_STATISTICS_DISPOSED);
555
+    });
551 556
     conference.statistics.addConnectionStatsListener(function (stats) {
552 557
         var ssrc2resolution = stats.resolution;
553 558
 

+ 8
- 0
JitsiConferenceEvents.js Näytä tiedosto

@@ -14,6 +14,14 @@ export const AVAILABLE_DEVICES_CHANGED = "conference.availableDevicesChanged";
14 14
  * A participant avatar has changed.
15 15
  */
16 16
 export const AVATAR_CHANGED = "conference.avatarChanged";
17
+
18
+/**
19
+ * Fired just before the statistics module is disposed and it's the last chance
20
+ * to submit some logs to the statistics service (ex. CallStats if enabled),
21
+ * before it's disconnected.
22
+ */
23
+export const BEFORE_STATISTICS_DISPOSED = "conference.beforeStatisticsDisposed";
24
+
17 25
 /**
18 26
  * Indicates that an error occured.
19 27
  */

+ 26
- 0
JitsiMeetJS.js Näytä tiedosto

@@ -142,6 +142,32 @@ var LibJitsiMeet = {
142 142
     setLogLevel: function (level) {
143 143
         Logger.setLogLevel(level);
144 144
     },
145
+    /**
146
+     * Sets the log level to the <tt>Logger</tt> instance with given id.
147
+     * @param {Logger.levels} level the logging level to be set
148
+     * @param {string} id the logger id to which new logging level will be set.
149
+     * Usually it's the name of the JavaScript source file including the path
150
+     * ex. "modules/xmpp/ChatRoom.js"
151
+     */
152
+    setLogLevelById: function (level, id) {
153
+        Logger.setLogLevelById(level, id);
154
+    },
155
+    /**
156
+     * Registers new global logger transport to the library logging framework.
157
+     * @param globalTransport
158
+     * @see Logger.addGlobalTransport
159
+     */
160
+    addGlobalLogTransport: function (globalTransport) {
161
+        Logger.addGlobalTransport(globalTransport);
162
+    },
163
+    /**
164
+     * Removes global logging transport from the library logging framework.
165
+     * @param globalTransport
166
+     * @see Logger.removeGlobalTransport
167
+     */
168
+    removeGlobalLogTransport: function (globalTransport) {
169
+        Logger.removeGlobalTransport(globalTransport);
170
+    },
145 171
     /**
146 172
      * Creates the media tracks and returns them trough the callback.
147 173
      * @param options Object with properties / settings specifying the tracks which should be created.

+ 1
- 0
doc/API.md Näytä tiedosto

@@ -121,6 +121,7 @@ JitsiMeetJS.setLogLevel(JitsiMeetJS.logLevels.ERROR);
121 121
         - STARTED_MUTED - notifies that the local user has started muted
122 122
         - AVAILABLE_DEVICES_CHANGED - notifies that available participant devices changed (camera or microphone was added or removed) (parameters - id(string), devices(JS object with 2 properties - audio(boolean), video(boolean)))
123 123
         - CONNECTION_STATS - New local connection statistics are received. (parameters - stats(object))
124
+        - BEFORE_STATISTICS_DISPOSED - fired just before the statistics module is disposed and it's the last chance to submit some logs to the statistics service, before it gets disconnected
124 125
         - AUTH_STATUS_CHANGED - notifies that authentication is enabled or disabled, or local user authenticated (logged in). (parameters - isAuthEnabled(boolean), authIdentity(string))
125 126
         - ENDPOINT_MESSAGE_RECEIVED - notifies that a new message
126 127
         from another participant is received on a data channel.

+ 12
- 0
modules/statistics/statistics.js Näytä tiedosto

@@ -144,6 +144,15 @@ Statistics.prototype.removeAudioLevelListener = function(listener) {
144 144
     this.eventEmitter.removeListener(StatisticsEvents.AUDIO_LEVEL, listener);
145 145
 };
146 146
 
147
+Statistics.prototype.addBeforeDisposedListener = function (listener) {
148
+    this.eventEmitter.on(StatisticsEvents.BEFORE_DISPOSED, listener);
149
+};
150
+
151
+Statistics.prototype.removeBeforeDisposedListener = function (listener) {
152
+    this.eventEmitter.removeListener(
153
+        StatisticsEvents.BEFORE_DISPOSED, listener);
154
+};
155
+
147 156
 Statistics.prototype.addConnectionStatsListener = function (listener) {
148 157
     this.eventEmitter.on(StatisticsEvents.CONNECTION_STATS, listener);
149 158
 };
@@ -162,6 +171,9 @@ Statistics.prototype.removeByteSentStatsListener = function (listener) {
162 171
 };
163 172
 
164 173
 Statistics.prototype.dispose = function () {
174
+    if (this.eventEmitter) {
175
+        this.eventEmitter.emit(StatisticsEvents.BEFORE_DISPOSED);
176
+    }
165 177
     this.stopCallStats();
166 178
     this.stopRemoteStats();
167 179
     if(this.eventEmitter)

+ 7
- 0
service/statistics/Events.js Näytä tiedosto

@@ -10,6 +10,13 @@
10 10
  */
11 11
 export const AUDIO_LEVEL = "statistics.audioLevel";
12 12
 
13
+/**
14
+ * An event fired just before the statistics module gets disposes and it's
15
+ * the last chance to submit some logs that will end up in stats services like
16
+ * CallStats (if enabled).
17
+ */
18
+export const BEFORE_DISPOSED = "statistics.before_disposed";
19
+
13 20
 /**
14 21
  * An event carrying all statistics by ssrc.
15 22
  */

Loading…
Peruuta
Tallenna