mirror of https://github.com/embarklabs/embark.git
Merge pull request #799 from embark-framework/feature/trace-console-log
Use trace logger for code runner error
This commit is contained in:
commit
0f635f8a33
|
@ -8,7 +8,7 @@ class CodeRunner {
|
|||
this.events = options.events;
|
||||
this.ipc = options.ipc;
|
||||
this.commands = [];
|
||||
this.runCode = new RunCode();
|
||||
this.runCode = new RunCode({logger: this.logger});
|
||||
this.registerIpcEvents();
|
||||
this.IpcClientListen();
|
||||
this.registerEvents();
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
const vm = require('vm');
|
||||
|
||||
class RunCode {
|
||||
constructor() {
|
||||
constructor({logger}) {
|
||||
this.logger = logger;
|
||||
this.context = Object.assign({}, {global, console, exports, require, module, __filename, __dirname});
|
||||
}
|
||||
|
||||
|
@ -9,7 +10,7 @@ class RunCode {
|
|||
try {
|
||||
return vm.runInNewContext(code, this.context);
|
||||
} catch(e) {
|
||||
console.error(e.message);
|
||||
this.logger.error(e.message);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue