diff --git a/lib/client/console.js b/lib/client/console.js index 3a530039..52ac0203 100644 --- a/lib/client/console.js +++ b/lib/client/console.js @@ -12,6 +12,10 @@ var CloudCmd, Util, DOM, CloudFunc, $; }, Loading, jqconsole, + + log = Util.bind(write, 'log'), + error = Util.bind(write, 'error'), + Element, MouseBinded, Socket, @@ -40,8 +44,6 @@ var CloudCmd, Util, DOM, CloudFunc, $; } this.show = show; - this.log = log; - this.error = error; function show(callback) { if (!Loading) { @@ -112,15 +114,7 @@ var CloudCmd, Util, DOM, CloudFunc, $; } } - function log(pText) { - write(pText, 'log'); - } - - function error(pText) { - write(pText, 'error'); - } - - function write(msg, status) { + function write(status, msg) { var isContain; if (msg) { @@ -179,6 +173,7 @@ var CloudCmd, Util, DOM, CloudFunc, $; function onMessage(json) { if (json) { Util.log(json); + log(json.stdout); error(json.stderr); }