Files
iNaturalistReactNative/react-native-logs.config.js
Ken-ichi ddca126ed5 refactor: log around repeat errors (#2293)
* Catch and squelch "Network request failed" errors that happen during logging itself (#1639)
* Log around RNSI access to resolve when/where those errors occur (#1639)
* Log around JWT retrieval to resolve when/where JWT missing errors occur (#2155)
2024-10-22 15:41:54 -07:00

42 lines
831 B
JavaScript

import iNatLogstashTransport from "api/log.ts";
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}`;
const transport = [];
transport.push( consoleTransport );
transport.push( fileAsyncTransport );
transport.push( iNatLogstashTransport );
const config = {
dateFormat: "iso",
// eslint-disable-next-line no-undef
severity: __DEV__
? "debug"
: "info",
transport,
transportOptions: {
FS: RNFS,
fileName
}
};
const log = logger.createLogger( config );
const logWithoutRemote = logger.createLogger( {
...config,
transport: [consoleTransport, fileAsyncTransport]
} );
export {
log,
logFilePath,
logWithoutRemote
};