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.
5 // Scripts to allow page console.log() etc. output to be seen on the console
6 // of the host application.
8 goog.provide('__crWeb.console');
10 goog.require('__crWeb.message');
13 * Namespace for this module.
15 __gCrWeb.console = {};
17 /* Beginning of anonymous object. */
19 function sendConsoleMessage(method, originalArguments) {
20 message = Array.prototype.slice.call(originalArguments).join(' ');
21 __gCrWeb.message.invokeOnHost({'command': 'console',
24 'origin': document.location.origin});
27 console.log = function() {
28 sendConsoleMessage('log', arguments);
31 console.debug = function() {
32 sendConsoleMessage('debug', arguments);
35 console.info = function() {
36 sendConsoleMessage('info', arguments);
39 console.warn = function() {
40 sendConsoleMessage('warn', arguments);
43 console.error = function() {
44 sendConsoleMessage('error', arguments);