I am currently developing a new project using Ionic (based on AngularJs) and so far everything is functioning as expected.
For debugging purposes, I have implemented a method where every 'Function call' (every step) is output to the console via a Debug-Function. This helps me quickly verify if each function is being called correctly.
Debug Function (simplified code):
.factory('DebugMode', ['$log', function($log) {
var DebugMode = {};
this.active = true;
this.console = function(LogLine, LogStyle)}
if(DebugMode.active){
$log.log(LogLine);
}
};
return DebugMode;
My query: I am wondering if there is a way or a technique to also capture that output (not specifically the console output, but the logs I write to it) into a file or variable?
My objective: To be able to access the log when the app is running independently without browser access. This will help in ensuring everything is functioning smoothly, or in case a client encounters issues, they can send the log to me via email or some other means.
For example (in the app): Navigate to settings from the menu, display log, identify where the app encountered an error, and/or press a button to send the log to me.
Would it be ideal to save everything in a 'log-output.date().txt' format or store them in a session variable that clears upon exiting?
Thank you in advance!
-Bert