From 93687efee9ebe43f8a4c1f884dde965fac04c321 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 12 Feb 2014 20:17:14 +0800 Subject: [PATCH] win: Use util.format to format arguments in console.log. --- browser/lib/init.coffee | 7 +++++-- common/api/atom_bindings.cc | 7 ++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/browser/lib/init.coffee b/browser/lib/init.coffee index 1b22b3d259b3..42e8df0d2017 100644 --- a/browser/lib/init.coffee +++ b/browser/lib/init.coffee @@ -1,5 +1,6 @@ fs = require 'fs' path = require 'path' +util = require 'util' # Expose information of current process. process.__atom_type = 'browser' @@ -28,8 +29,10 @@ setImmediate -> if process.platform is 'win32' # Redirect node's console to use our own implementations, since node can not # handle console output when running as GUI program. - console.log = console.error = console.warn = process.log - process.stdout.write = process.stderr.write = process.log + print = (args...) -> + process.log util.format(args...) + console.log = console.error = console.warn = print + process.stdout.write = process.stderr.write = print # Always returns EOF for stdin stream. Readable = require('stream').Readable diff --git a/common/api/atom_bindings.cc b/common/api/atom_bindings.cc index faa139a6c610..060486b45756 100644 --- a/common/api/atom_bindings.cc +++ b/common/api/atom_bindings.cc @@ -158,11 +158,8 @@ void AtomBindings::ActivateUVLoop( // static void AtomBindings::Log(const v8::FunctionCallbackInfo& args) { - std::string message; - for (int i = 0; i < args.Length(); ++i) - message += *v8::String::Utf8Value(args[i]); - - logging::LogMessage("CONSOLE", 0, 0).stream() << message; + v8::String::Utf8Value str(args[0]); + logging::LogMessage("CONSOLE", 0, 0).stream() << *str; } // static