Skip to content

Instantly share code, notes, and snippets.

@fizerkhan
Last active June 15, 2016 12:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fizerkhan/6ea7d37f3d018885dba707762576c86e to your computer and use it in GitHub Desktop.
Save fizerkhan/6ea7d37f3d018885dba707762576c86e to your computer and use it in GitHub Desktop.
(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