Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: remoting/webapp/me2mom/log_to_server.js

Issue 8527011: The chromoting client sends simple logging to the server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review. Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 /**
6 * @fileoverview
7 * Module for sending log entries to the server.
8 */
9
10 'use strict';
11
12 /** @suppress {duplicate} */
13 var remoting = remoting || {};
14
15 /**
16 * @constructor
17 */
18 remoting.LogToServer = function() {
19 /** @type Array.<string> */ this.pendingEntries = [];
20 };
21
22 /**
23 * Logs a client session state change.
24 *
25 * @param {remoting.ClientSession.State} state
26 * @param {remoting.ClientSession.ConnectionError} connectionError
27 */
28 remoting.LogToServer.prototype.logClientSessionStateChange =
29 function(state, connectionError) {
30 var entry = remoting.ServerLogEntry.prototype.makeClientSessionStateChange(
Jamie 2011/11/11 19:08:40 If this is effectively a static function, there's
31 state, connectionError);
32 entry.addHostFields();
33 entry.addChromeVersionField();
34 entry.addWebappVersionField();
35 this.log(entry);
36 };
37
38 /**
39 * Sends a log entry to the server.
40 *
41 * @private
42 * @param {remoting.ServerLogEntry} entry
43 */
44 remoting.LogToServer.prototype.log = function(entry) {
45 // Store a stanza for the entry
46 this.pendingEntries.push(entry.toStanza());
47 // Stop if there's no connection to the server.
48 if (!remoting.wcs) {
49 return;
50 }
51 // Send all pending entries to the server.
52 var stanza = '<cli:iq to="remoting@bot.talk.google.com" type="set" ' +
53 'xmlns:cli="jabber:client"><gr:log xmlns:gr="google:remoting">';
54 while (this.pendingEntries.length > 0) {
55 stanza += /** @type string */ this.pendingEntries.shift();
56 }
57 stanza += '</gr:log></cli:iq>';
58 remoting.debug.logIq(true, stanza);
59 remoting.wcs.sendIq(stanza);
60 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698