Writing log into file


#1

Hi, iam working on an app, that reads barcode on ticket, checks code against database and decide, if the ticket is valid or not. I need some output, some file with history. Iam using filePlugin for this and i have a few question. Where do u recommend to save such files on mobile? In download directory? Or for example in file.dataDirectory?

Another question is, when iam using file.writeFile method, with parametres append: true and replace:false, it doesnt create new file, if it doesnt exist so far? If i omit the append parameter, it creates new file, but it doesnt append to it … How do u solve the problem? Do i really have to check if file exists first and then siwtch append parameter based on it? Or is there some more elegant way?


#3

Here’s a simple file logger for Ionic 2+

SmartMoveSystems/ionicLogFileAppender
ionicLogFileAppender - Simple log file appender for Ionic 3

Full disclosure: I am the developer