1 // Copyright 2015 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.
7 * Class to handle debug log messages sent by either the It2Me or Me2Me native
13 /** @suppress {duplicate} */
14 var remoting = remoting || {};
21 remoting.NativeMessageHostDebugMessageHandler = function() {
25 * Handle debug messages..
27 * @param {Object} message
28 * @return {boolean} True if the message was handled.
30 remoting.NativeMessageHostDebugMessageHandler.prototype.handleMessage =
34 var type = base.getStringAttr(message, 'type', '');
37 var timestamp = base.timestamp();
38 var msg = base.getStringAttr(message, 'message', '<no message>');
39 var severity = base.getStringAttr(message, 'severity', 'log');
40 var file = base.getStringAttr(message, 'file', '<no file>');
41 var line = base.getNumberAttr(message, 'line', -1);
42 var location = file + ':' + line;
43 var css = 'color: gray; font-style: italic'
46 console.error('%s %s %c%s', timestamp, msg, css, location);
49 console.warn('%s %s %c%s', timestamp, msg, css, location);
52 console.log('%s %s %c%s', timestamp, msg, css, location);