From 2529b39958b749c4ffbc3d9e9bcac4ad7b34e388 Mon Sep 17 00:00:00 2001 From: knoxHuang <821686174@qq.com> Date: Mon, 29 Feb 2016 10:11:11 +0800 Subject: [PATCH 1/2] Modify cc.log prompt mode --- CCDebugger.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/CCDebugger.js b/CCDebugger.js index a027b183af..1d9cafc807 100644 --- a/CCDebugger.js +++ b/CCDebugger.js @@ -471,9 +471,18 @@ cc._initDebugSetting = function (mode) { * @param {any} obj - A JavaScript string containing zero or more substitution strings. * @param {any} ...subst - JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output. */ - cc.log = function () { - return console.log.apply(console, arguments); - }; + if (CC_EDITOR) { + cc.log = Editor.log; + } + else if (console.log.bind) { + // use bind to avoid pollute call stacks + cc.log = console.log.bind(console); + } + else { + cc.log = function () { + return console.log.apply(console, arguments); + }; + } /** * Outputs an informational message to the Cocos Creator Console (editor) or Web Console (runtime). * - In Cocos Creator, info is blue. From 9e23d68ffa08425586eaa403f00aba95b06eb79c Mon Sep 17 00:00:00 2001 From: knoxHuang <821686174@qq.com> Date: Mon, 29 Feb 2016 10:15:55 +0800 Subject: [PATCH 2/2] Modify cc.log code --- CCDebugger.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/CCDebugger.js b/CCDebugger.js index 1d9cafc807..2b68d028a7 100644 --- a/CCDebugger.js +++ b/CCDebugger.js @@ -471,10 +471,7 @@ cc._initDebugSetting = function (mode) { * @param {any} obj - A JavaScript string containing zero or more substitution strings. * @param {any} ...subst - JavaScript objects with which to replace substitution strings within msg. This gives you additional control over the format of the output. */ - if (CC_EDITOR) { - cc.log = Editor.log; - } - else if (console.log.bind) { + if (console.log.bind) { // use bind to avoid pollute call stacks cc.log = console.log.bind(console); }