1.0.3 • Published 6 years ago
react-native-log-to-file v1.0.3
react-native-log-to-file
Log message to file in react native, work for Android. Get memory information, just work for Android.
Installation
Install package from npm
npm install --save react-native-log-to-fileor
yarn add react-native-log-to-fileLink to your project
react-native linkUsage
log to file
import log from 'react-native-log-to-file';
log.logToFile('app started').then(res=>{
console.log(res);
})The log file locate in 'applicationName/applicationName_log.log'.
get used memory
import log from 'react-native-log-to-file';
Log.getUsedMemory().then(usedMemory => {
let used = (usedMemory / 1024 / 1024).toFixed(2);
})get max memory
import log from 'react-native-log-to-file';
Log.getMaxMemory().then(maxMemory => {
let max = (maxMemory / 1024 / 1024).toFixed(2);
})get total memory
import log from 'react-native-log-to-file';
Log.getTotalMemory().then(totalMemory => {
let total = (totalMemory / 1024 / 1024).toFixed(2);
})