Skip to content

Commit

Permalink
Add more information to Room logs (#1411)
Browse files Browse the repository at this point in the history
  • Loading branch information
lodoyun committed May 14, 2019
1 parent 89c0d8e commit 563e584
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions erizo_controller/erizoClient/src/Room.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ const Room = (altIo, altConnectionHelpers, altConnectionManager, specInput) => {
slideShowMode: options.slideShowMode };
socket.sendSDP('subscribe', constraint, undefined, (result, erizoId, error) => {
if (result === null) {
Logger.error('Error subscribing to stream ', error);
Logger.error(`Error subscribing to stream, streamId: ${stream.getID()}, error:`, error);
callback(undefined, error);
return;
}
Expand All @@ -569,7 +569,7 @@ const Room = (altIo, altConnectionHelpers, altConnectionManager, specInput) => {
metadata: options.metadata },
undefined, (result, error) => {
if (result === null) {
Logger.error('Error subscribing to stream ', error);
Logger.error(`Error subscribing to stream, streamId: ${stream.getID()}, error:`, error);
callback(undefined, error);
return;
}
Expand Down Expand Up @@ -619,7 +619,7 @@ const Room = (altIo, altConnectionHelpers, altConnectionManager, specInput) => {
const token = Base64.decodeBase64(spec.token);

if (that.state !== DISCONNECTED) {
Logger.warning('Room already connected');
Logger.warning(`Room already connected, roomId: ${that.roomID}`);
}

// 1- Connect to Erizo-Controller
Expand Down Expand Up @@ -657,12 +657,12 @@ const Room = (altIo, altConnectionHelpers, altConnectionManager, specInput) => {
// 3 - Update RoomID
that.roomID = roomId;

Logger.info(`Connected to room ${that.roomID}`);
Logger.info(`Connected to room, roomId ${that.roomID}`);

const connectEvt = RoomEvent({ type: 'room-connected', streams: streamList });
that.dispatchEvent(connectEvt);
}, (error) => {
Logger.error(`Not Connected! Error: ${error}`);
Logger.error(`Error connecting to room, roomId: ${that.roomID}, Error:`, error);
const connectEvt = RoomEvent({ type: 'room-error', message: error });
that.dispatchEvent(connectEvt);
});
Expand Down Expand Up @@ -720,22 +720,22 @@ const Room = (altIo, altConnectionHelpers, altConnectionManager, specInput) => {
publishData(stream, options, callback);
}
} else {
Logger.error('Trying to publish invalid stream');
Logger.error('Trying to publish invalid stream, stream:', stream);
callback(undefined, 'Invalid Stream');
}
};

// Returns callback(id, error)
that.startRecording = (stream, callback = () => {}) => {
if (stream === undefined) {
Logger.error('Trying to start recording on an invalid stream', stream);
Logger.error('Trying to start recording on an invalid stream, stream:', stream);
callback(undefined, 'Invalid Stream');
return;
}
Logger.debug(`Start Recording stream: ${stream.getID()}`);
Logger.debug(`Start Recording stream, streamId: ${stream.getID()}`);
socket.sendMessage('startRecorder', { to: stream.getID() }, (id, error) => {
if (id === null) {
Logger.error('Error on start recording', error);
Logger.error(`Error on start recording, streamId: ${stream.getID()}, error:`, error);
callback(undefined, error);
return;
}
Expand All @@ -749,7 +749,7 @@ const Room = (altIo, altConnectionHelpers, altConnectionManager, specInput) => {
that.stopRecording = (recordingId, callback = () => {}) => {
socket.sendMessage('stopRecorder', { id: recordingId }, (result, error) => {
if (result === null) {
Logger.error('Error on stop recording', error);
Logger.error(`Error on stop recording, recordingId: ${recordingId}, error:`, error);
callback(undefined, error);
return;
}
Expand All @@ -766,7 +766,7 @@ const Room = (altIo, altConnectionHelpers, altConnectionManager, specInput) => {
// Media stream
socket.sendMessage('unpublish', stream.getID(), (result, error) => {
if (result === null) {
Logger.error('Error unpublishing stream', error);
Logger.error(`Error unpublishing stream, streamId: ${stream.getID()}, error:`, error);
callback(undefined, error);
return;
}
Expand All @@ -775,7 +775,7 @@ const Room = (altIo, altConnectionHelpers, altConnectionManager, specInput) => {
callback(true);
});

Logger.info('Stream unpublished');
Logger.info(`Stream unpublished, streamId: ${stream.getID()}`);
stream.room = undefined;
if (stream.hasMedia() && !stream.isExternal()) {
const localStream = localStreams.has(stream.getID()) ?
Expand Down Expand Up @@ -835,7 +835,7 @@ const Room = (altIo, altConnectionHelpers, altConnectionManager, specInput) => {
} else if (stream.hasData() && options.data !== false) {
subscribeData(stream, options, callback);
} else {
Logger.warning('There\'s nothing to subscribe to');
Logger.warning(`There is nothing to subscribe to in stream, streamId: ${stream.getID()}`);
callback(undefined, 'Nothing to subscribe to');
return;
}
Expand All @@ -844,14 +844,15 @@ const Room = (altIo, altConnectionHelpers, altConnectionManager, specInput) => {
} else {
let error = 'Error on subscribe';
if (!stream) {
Logger.warning('Cannot subscribe to invalid stream');
Logger.warning(`Cannot subscribe to invalid stream, streamId: ${stream.getID()}`);
error = 'Invalid or undefined stream';
} else if (stream.local) {
Logger.warning('Cannot subscribe to local stream, you should ' +
'subscribe to the remote version of your local stream');
error = 'Local copy of stream';
} else if (stream.failed) {
Logger.warning('Cannot subscribe to failed stream.');
Logger.warning(`Cannot subscribe to failed stream, streamId: ${stream.getID()}, unsubscribing:`,
stream.unsubscribing, ' failed: ', stream.failed);
error = 'Failed stream';
}
callback(undefined, error);
Expand All @@ -873,7 +874,7 @@ const Room = (altIo, altConnectionHelpers, altConnectionManager, specInput) => {
stream.unsubscribing.callbackReceived = true;
maybeDispatchStreamUnsubscribed(stream);
}, () => {
Logger.error('Error calling unsubscribe.');
Logger.error(`Error calling unsubscribe, streamId: ${stream.getID()}`);
});
} else {
callback(undefined,
Expand Down

0 comments on commit 563e584

Please sign in to comment.