簡體   English   中英

在angularJS中實現自定義$ exceptionHandler時,如何保留默認日志?

[英]When implementing a custom $exceptionHandler in angularJS, how do I preserve default log?

我正在使用自定義angularJS $exceptionHandler (將客戶端異常發送到我的服務器):

app.factory('$exceptionHandler', function() {
  return function(exception, cause) {
    //custom handling of the exception
    //...
  };
});

如何保留默認控制台日志?

可以使用$log保留默認$log

app.factory('$exceptionHandler', ['$log', function($log) {
  return function(exception, cause) {
    //custom handling of the exception
    //...
    $log.error.apply($log, arguments);
  };
}]);

有關此博客文章的更多信息。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM