[英]When implementing a custom $exceptionHandler in angularJS, how do I preserve default log?
I am using a custom angularJS $exceptionHandler
(to send client exceptions to my server) : 我正在使用自定义angularJS
$exceptionHandler
(将客户端异常发送到我的服务器):
app.factory('$exceptionHandler', function() {
return function(exception, cause) {
//custom handling of the exception
//...
};
});
How do I preserve default console log ? 如何保留默认控制台日志?
Default log can be preserved by using $log
: 可以使用
$log
保留默认$log
:
app.factory('$exceptionHandler', ['$log', function($log) {
return function(exception, cause) {
//custom handling of the exception
//...
$log.error.apply($log, arguments);
};
}]);
More info on this blog post . 有关此博客文章的更多信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.