feat: 添加异常拦截和打印

This commit is contained in:
coding
2017-10-20 09:14:42 +00:00
parent e5f212fd6b
commit 1058677c5f
4 changed files with 55 additions and 29 deletions

View File

@ -27,6 +27,12 @@ var log = base.getLog().static;
this.debug = function () {
log.d(this.name + Array.prototype.join.call(arguments, ' '));
}
this.ex = function (ex) {
log.console('§4' + ex);
ex.getStackTrace().forEach(function (stack) {
log.console(' §e位于 §c%s §4行%s', stack.fileName, stack.lineNumber);
});
}
}
global.Console = Console;
global.console = new Console();