Last active
June 15, 2016 12:50
-
-
Save fizerkhan/6ea7d37f3d018885dba707762576c86e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
"use strict"; | |
angular | |
.module( appName, [ ] ) | |
.config([ "$provide", function( $provide ) | |
{ | |
// Use the `decorator` solution to substitute or attach behaviors to | |
// original service instance; | |
$provide.decorator( '$log', [ "$delegate", function( $delegate ) | |
{ | |
// Save the original $log.error() | |
var errorFn = $delegate.error; | |
$delegate.error = function( ) | |
{ | |
var args = [].slice.call(arguments), | |
msg = args.join(' '); | |
// Send error to atatus | |
atatus.notify(new Error(msg)); | |
// Call the original with the arguments | |
errorFn.apply(null, args) | |
}; | |
return $delegate; | |
}]); | |
}]); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment