| 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 * Module for sending log entries to the server. | 7 * Module for sending log entries to the server. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 'use strict'; | 10 'use strict'; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 }; | 167 }; |
| 168 | 168 |
| 169 /** | 169 /** |
| 170 * Sends a log entry to the server. | 170 * Sends a log entry to the server. |
| 171 * | 171 * |
| 172 * @private | 172 * @private |
| 173 * @param {remoting.ServerLogEntry} entry | 173 * @param {remoting.ServerLogEntry} entry |
| 174 */ | 174 */ |
| 175 remoting.LogToServer.prototype.log_ = function(entry) { | 175 remoting.LogToServer.prototype.log_ = function(entry) { |
| 176 // Log the time taken to get to this point from the time this session started. | 176 // Log the time taken to get to this point from the time this session started. |
| 177 var elapsedTimeInMs = new Date().getTime() - this.sessionStartTime_; | 177 var sessionDurationInSeconds = |
| 178 entry.addElapsedTimeMs(elapsedTimeInMs); | 178 (new Date().getTime() - this.sessionStartTime_) / 1000.0; |
| 179 entry.addSessionDuration(sessionDurationInSeconds); |
| 179 | 180 |
| 180 // Send the stanza to the debug log. | 181 // Send the stanza to the debug log. |
| 181 console.log('Enqueueing log entry:'); | 182 console.log('Enqueueing log entry:'); |
| 182 entry.toDebugLog(1); | 183 entry.toDebugLog(1); |
| 183 | 184 |
| 184 var stanza = '<cli:iq to="' + remoting.settings.DIRECTORY_BOT_JID + '" ' + | 185 var stanza = '<cli:iq to="' + remoting.settings.DIRECTORY_BOT_JID + '" ' + |
| 185 'type="set" xmlns:cli="jabber:client">' + | 186 'type="set" xmlns:cli="jabber:client">' + |
| 186 '<gr:log xmlns:gr="google:remoting">' + | 187 '<gr:log xmlns:gr="google:remoting">' + |
| 187 entry.toStanza() + | 188 entry.toStanza() + |
| 188 '</gr:log>' + | 189 '</gr:log>' + |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 remoting.LogToServer.generateSessionId_ = function() { | 245 remoting.LogToServer.generateSessionId_ = function() { |
| 245 var idArray = []; | 246 var idArray = []; |
| 246 for (var i = 0; i < remoting.LogToServer.SESSION_ID_LEN_; i++) { | 247 for (var i = 0; i < remoting.LogToServer.SESSION_ID_LEN_; i++) { |
| 247 var index = | 248 var index = |
| 248 Math.random() * remoting.LogToServer.SESSION_ID_ALPHABET_.length; | 249 Math.random() * remoting.LogToServer.SESSION_ID_ALPHABET_.length; |
| 249 idArray.push( | 250 idArray.push( |
| 250 remoting.LogToServer.SESSION_ID_ALPHABET_.slice(index, index + 1)); | 251 remoting.LogToServer.SESSION_ID_ALPHABET_.slice(index, index + 1)); |
| 251 } | 252 } |
| 252 return idArray.join(''); | 253 return idArray.join(''); |
| 253 }; | 254 }; |
| OLD | NEW |