I have a Angular 5 application with any javascript console.log("...");
I want create and add a javascript file on top on my application that overloads all console.log("...");
with a POST function to a Web Services.
If my classic application log this:
console.log("start");
console.log("error");
console.log("stop");
I want my Angular5 application to process 3 asynchone POST requests to my Web Services. Example:
POST {"user": "foo", "log": "start"}
POST {"user": "foo", "log": "error"}
POST {"user": "foo", "log": "stop"}
Note: The user in the body is just an example because the final version uses a Json Web Token in the header.
Is there a library to do this because it seems like a basic feature?
How about replacing the default log function.
(function() { var oldLog = console.log; console.log = function(msg) { oldLog.apply(console, arguments); alert(msg); } })() console.log("test")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.