OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview | 6 * @fileoverview |
7 * A class of server log entries. | 7 * A class of server log entries. |
8 * | 8 * |
9 * Any changes to the values here need to be coordinated with the host and | 9 * Any changes to the values here need to be coordinated with the host and |
10 * server/log proto code. | 10 * server/log proto code. |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 } | 209 } |
210 console.log(Array(indentLevel+1).join(" ") + fields.join(', ')); | 210 console.log(Array(indentLevel+1).join(" ") + fields.join(', ')); |
211 }; | 211 }; |
212 | 212 |
213 /** | 213 /** |
214 * Makes a log entry for a change of client session state. | 214 * Makes a log entry for a change of client session state. |
215 * | 215 * |
216 * @param {remoting.ClientSession.State} state | 216 * @param {remoting.ClientSession.State} state |
217 * @param {!remoting.Error} connectionError | 217 * @param {!remoting.Error} connectionError |
218 * @param {string} mode The current app mode (It2Me, Me2Me, AppRemoting). | 218 * @param {string} mode The current app mode (It2Me, Me2Me, AppRemoting). |
| 219 * @param {string} role 'client' if the app is acting as a Chromoting client |
| 220 * or 'host' if it is acting as a host (IT2Me) |
219 * @return {remoting.ServerLogEntry} | 221 * @return {remoting.ServerLogEntry} |
220 */ | 222 */ |
221 remoting.ServerLogEntry.makeClientSessionStateChange = function(state, | 223 remoting.ServerLogEntry.makeClientSessionStateChange = function(state, |
222 connectionError, mode) { | 224 connectionError, mode, role) { |
223 var entry = new remoting.ServerLogEntry(); | 225 var entry = new remoting.ServerLogEntry(); |
224 entry.set_(remoting.ServerLogEntry.KEY_ROLE_, | 226 entry.set_(remoting.ServerLogEntry.KEY_ROLE_, role); |
225 remoting.ServerLogEntry.VALUE_ROLE_CLIENT_); | |
226 entry.set_(remoting.ServerLogEntry.KEY_EVENT_NAME_, | 227 entry.set_(remoting.ServerLogEntry.KEY_EVENT_NAME_, |
227 remoting.ServerLogEntry.VALUE_EVENT_NAME_SESSION_STATE_); | 228 remoting.ServerLogEntry.VALUE_EVENT_NAME_SESSION_STATE_); |
228 entry.set_(remoting.ServerLogEntry.KEY_SESSION_STATE_, | 229 entry.set_(remoting.ServerLogEntry.KEY_SESSION_STATE_, |
229 remoting.ServerLogEntry.getValueForSessionState_(state)); | 230 remoting.ServerLogEntry.getValueForSessionState_(state)); |
230 if (!connectionError.isNone()) { | 231 if (!connectionError.isNone()) { |
231 entry.set_(remoting.ServerLogEntry.KEY_CONNECTION_ERROR_, | 232 entry.set_(remoting.ServerLogEntry.KEY_CONNECTION_ERROR_, |
232 remoting.ServerLogEntry.getValueForError_(connectionError)); | 233 remoting.ServerLogEntry.getValueForError_(connectionError)); |
233 } | 234 } |
234 entry.addModeField(mode); | 235 entry.addModeField(mode); |
235 return entry; | 236 return entry; |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 this.set_(remoting.ServerLogEntry.KEY_MODE_, mode); | 433 this.set_(remoting.ServerLogEntry.KEY_MODE_, mode); |
433 }; | 434 }; |
434 | 435 |
435 /** | 436 /** |
436 * Adds a field specifying the application ID to this log entry. | 437 * Adds a field specifying the application ID to this log entry. |
437 * @return {void} Nothing. | 438 * @return {void} Nothing. |
438 */ | 439 */ |
439 remoting.ServerLogEntry.prototype.addApplicationId = function() { | 440 remoting.ServerLogEntry.prototype.addApplicationId = function() { |
440 this.set_(remoting.ServerLogEntry.KEY_APP_ID_, chrome.runtime.id); | 441 this.set_(remoting.ServerLogEntry.KEY_APP_ID_, chrome.runtime.id); |
441 }; | 442 }; |
442 | |
OLD | NEW |