mirror of
https://github.com/HackPlan/atom-shell.git
synced 2026-04-24 03:46:03 +08:00
[Win] Override node's console and output stream with chromium's logging.
On Window node doesn't outputing as GUI program, so we have to switch to chromium's implementation. Hacking into node (like what we did before this commit) would sometimes make the outputing blocked.
This commit is contained in:
@@ -35,6 +35,7 @@ void AtomBindings::BindTo(v8::Handle<v8::Object> process) {
|
||||
node::SetMethod(process, "atomBinding", Binding);
|
||||
node::SetMethod(process, "crash", Crash);
|
||||
node::SetMethod(process, "activateUvLoop", ActivateUVLoop);
|
||||
node::SetMethod(process, "log", Log);
|
||||
}
|
||||
|
||||
// static
|
||||
@@ -96,4 +97,14 @@ v8::Handle<v8::Value> AtomBindings::ActivateUVLoop(const v8::Arguments& args) {
|
||||
return v8::Undefined();
|
||||
}
|
||||
|
||||
// static
|
||||
v8::Handle<v8::Value> AtomBindings::Log(const v8::Arguments& 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;
|
||||
return v8::Undefined();
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
||||
@@ -23,6 +23,7 @@ class AtomBindings {
|
||||
static v8::Handle<v8::Value> Binding(const v8::Arguments& args);
|
||||
static v8::Handle<v8::Value> Crash(const v8::Arguments& args);
|
||||
static v8::Handle<v8::Value> ActivateUVLoop(const v8::Arguments& args);
|
||||
static v8::Handle<v8::Value> Log(const v8::Arguments& args);
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(AtomBindings);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user