Created
September 10, 2015 02:05
-
-
Save adamduren/9e45ca363e6bd8c72a1b to your computer and use it in GitHub Desktop.
Remote logger in angularJs using console.re
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
.config(['$provide', ($provide) => { | |
$provide.decorator('$log', ($delegate) => { | |
let wrapper = {}; | |
Object.keys($delegate).forEach((key) => { | |
let delegateFn = $delegate[key]; | |
let remoteFn = console.re[key]; | |
wrapper[key] = () => { | |
delegateFn.apply(delegateFn, arguments); | |
remoteFn.apply(remoteFn, arguments); | |
}; | |
}); | |
return wrapper; | |
}); | |
}]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment