Search code examples
cordovaionic-frameworkcordova-pluginsionic4ionic-native

How to write log file for mobile app using ionic/ ionic-native


I am trying to create a log file using ionic/ionic native. I using these two plugins. but not able to write log file properly. I want to write log file, which I can read and write.

$ ionic cordova plugin add cordova-plugin-file $ npm install --save @ionic-native/file@4

I am writing some code. If this way is not correct to write log please let me know another way.

let path = this.file.createDir(this.file.cacheDirectory, 'myapp', false)

path.then(data => {
              alert("data" + data)
              let filePath = this.file.createFile(data.toURL(), "myappfile", false)

 var file1 = this.file.writeExistingFile(data.toURL(), "myappfile", "hi i m hitesh")
 var file2 = this.file.writeExistingFile(data.toURL(), "myappfile", "working")

I want to write log file, which I can read and write.


Solution

  • https://github.com/apache/cordova-plugin-file/issues/262

    there is an issue with ionic. and this is still open. can not writ more than one message in same file at a time.