mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2025-12-23 22:18:36 -05:00
* Made react-native-logs post to API log endpoint
* Try to build a slightly more informative user agent
* Made react-native-logs post to API log endpoint
* Try to build a slightly more informative user agent
* Remove unused const
* Replace other usages of exported user agent
* Revert "Remove unused const"
This reverts commit 02389c8390.
* Revert removal of axios instance
* Strange order
* Remove device name from user agent
* Copy logstash transporter to new file and change to post
* Update import
* Remove comma
* Get the user jwt token as authorization for the log request
* Use anonymous token as app token
* Mock away logs config file because it now has a dependency on authentication
* Code style
* Typo
* Add timestamp field to form data, to show client_timestamp on the logs
* Add TODO
* Add a developer button to force a js-side error
* Add comments
---------
Co-authored-by: Ken-ichi Ueda <kenichi.ueda@gmail.com>
36 lines
692 B
JavaScript
36 lines
692 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 );
|
|
|
|
export {
|
|
log,
|
|
logFilePath
|
|
};
|