Explorar el Código

Merge pull request #320 from jitsi/log_collector

Log collector
dev1
hristoterezov hace 9 años
padre
commit
147060da93

+ 5
- 0
JitsiConferenceEventManager.js Ver fichero

548
 
548
 
549
         conference.rtc.setAudioLevel(resource, level);
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
     conference.statistics.addConnectionStatsListener(function (stats) {
556
     conference.statistics.addConnectionStatsListener(function (stats) {
552
         var ssrc2resolution = stats.resolution;
557
         var ssrc2resolution = stats.resolution;
553
 
558
 

+ 8
- 0
JitsiConferenceEvents.js Ver fichero

14
  * A participant avatar has changed.
14
  * A participant avatar has changed.
15
  */
15
  */
16
 export const AVATAR_CHANGED = "conference.avatarChanged";
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
  * Indicates that an error occured.
26
  * Indicates that an error occured.
19
  */
27
  */

+ 26
- 0
JitsiMeetJS.js Ver fichero

142
     setLogLevel: function (level) {
142
     setLogLevel: function (level) {
143
         Logger.setLogLevel(level);
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
      * Creates the media tracks and returns them trough the callback.
172
      * Creates the media tracks and returns them trough the callback.
147
      * @param options Object with properties / settings specifying the tracks which should be created.
173
      * @param options Object with properties / settings specifying the tracks which should be created.

+ 1
- 0
doc/API.md Ver fichero

121
         - STARTED_MUTED - notifies that the local user has started muted
121
         - STARTED_MUTED - notifies that the local user has started muted
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)))
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
         - CONNECTION_STATS - New local connection statistics are received. (parameters - stats(object))
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
         - AUTH_STATUS_CHANGED - notifies that authentication is enabled or disabled, or local user authenticated (logged in). (parameters - isAuthEnabled(boolean), authIdentity(string))
125
         - AUTH_STATUS_CHANGED - notifies that authentication is enabled or disabled, or local user authenticated (logged in). (parameters - isAuthEnabled(boolean), authIdentity(string))
125
         - ENDPOINT_MESSAGE_RECEIVED - notifies that a new message
126
         - ENDPOINT_MESSAGE_RECEIVED - notifies that a new message
126
         from another participant is received on a data channel.
127
         from another participant is received on a data channel.

+ 12
- 0
modules/statistics/statistics.js Ver fichero

144
     this.eventEmitter.removeListener(StatisticsEvents.AUDIO_LEVEL, listener);
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
 Statistics.prototype.addConnectionStatsListener = function (listener) {
156
 Statistics.prototype.addConnectionStatsListener = function (listener) {
148
     this.eventEmitter.on(StatisticsEvents.CONNECTION_STATS, listener);
157
     this.eventEmitter.on(StatisticsEvents.CONNECTION_STATS, listener);
149
 };
158
 };
162
 };
171
 };
163
 
172
 
164
 Statistics.prototype.dispose = function () {
173
 Statistics.prototype.dispose = function () {
174
+    if (this.eventEmitter) {
175
+        this.eventEmitter.emit(StatisticsEvents.BEFORE_DISPOSED);
176
+    }
165
     this.stopCallStats();
177
     this.stopCallStats();
166
     this.stopRemoteStats();
178
     this.stopRemoteStats();
167
     if(this.eventEmitter)
179
     if(this.eventEmitter)

+ 7
- 0
service/statistics/Events.js Ver fichero

10
  */
10
  */
11
 export const AUDIO_LEVEL = "statistics.audioLevel";
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
  * An event carrying all statistics by ssrc.
21
  * An event carrying all statistics by ssrc.
15
  */
22
  */

Loading…
Cancelar
Guardar