Files
iNaturalistReactNative/react-native-logs.config.js
Ken-ichi 7a7e6619e7 Fix sign out after force quit in Android (#375)
Removes intentional Realm file deletion to avoid unintentional Realm file deletion, though the latter remains something of a mystery.

* Configure Realm with the full path to the file
* Remove all Realm.open calls in AuthenticationService in favor of passing the
  context/provider copy of realm (only one realm instance)
* Only delete the realm file on sign out if deleting realm contents fails for
  some reason
* Replaced deleteRealm with semantically more accurate clearRealm

Closes #373
2023-01-23 18:34:58 -08:00

33 lines
646 B
JavaScript

import RNFS from "react-native-fs";
import {
consoleTransport,
fileAsyncTransport,
logger
} from "react-native-logs";
const fileName = "inaturalist-rn-log.txt";
const logFilePath = `${RNFS.DocumentDirectoryPath}/${fileName}`;
// Configure without transport for test. If you want to write output during
// tests, use console.log
const transport = [];
if ( process?.env?.NODE_ENV !== "test" ) {
transport.push( consoleTransport );
transport.push( fileAsyncTransport );
}
const config = {
transport,
transportOptions: {
FS: RNFS,
fileName
}
};
const log = logger.createLogger( config );
export {
log,
logFilePath
};