0.1.46 • Published 5 years ago
react-native-asoft-logger v0.1.46
react-native-asoft-logger
Asoft logger
Installation
npm install react-native-asoft-logger --save
npm install react-native-fs --save
npm install rn-fetch-blob --saveExample usage without logs upload feature
import RNFS from 'react-native-fs';
import AL from 'react-native-asoft-logger';
import { AsoftLoggerConfig } from 'react-native-asoft-logger/lib/typescript/src/AsoftLogger';
import moment from 'moment';
const logFileSchemaDefault: string = 'gss-audit-logs-';
const gssLoggerConfig : AsoftLoggerConfig = {
logFileSchema: logFileSchemaDefault,
logFileName: `${logFileSchemaDefault}${moment().format('YYYY-MM-DD').toString()}`,
internalLogsPath: `${RNFS.DocumentDirectoryPath}/asoft/gss`,
externalLogsPath: `${RNFS.ExternalStorageDirectoryPath}/asoft/gss`,
}
const gssLogger = new AL.AsoftLogger(gssLoggerConfig);
const externalLogsPath = gssLogger.getExternalLogsPath();
export default gssLogger;
export { externalLogsPath };Example usage with logs upload feature
import http from './httpService';
import RNFS from 'react-native-fs';
import AL from 'react-native-asoft-logger';
import Endpoint from './endpoints';
import { AsoftLoggerConfig } from 'react-native-asoft-logger/lib/typescript/src/AsoftLogger';
import moment from 'moment';
const logFileSchemaDefault: string = 'gsc-audit-logs-';
const trustLoggerConfig : AsoftLoggerConfig = {
logFileSchema: logFileSchemaDefault,
logFileName: `${logFileSchemaDefault}${moment().format('YYYY-MM-DD').toString()}`,
internalLogsPath: `${RNFS.DocumentDirectoryPath}/asoft/gsc`,
externalLogsPath: `${RNFS.ExternalStorageDirectoryPath}/asoft/gsc`,
}
const trustLogger = new AL.AsoftLogger(trustLoggerConfig).withUpload(http, Endpoint.Storage.GetSasTokenForAuditLogs);
const externalLogsPath = trustLogger.getExternalLogsPath();
const httpInstance = trustLogger.getHttpInstace();
const sasTokenEndpoint = trustLogger.getSasTokenEndpoint();
export default trustLogger;
export { externalLogsPath, httpInstance, sasTokenEndpoint };Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT
0.1.46
5 years ago
0.1.44
6 years ago
0.1.45
6 years ago
0.1.43
6 years ago
0.1.41
6 years ago
0.1.42
6 years ago
0.1.40
6 years ago
0.1.38
6 years ago
0.1.39
6 years ago
0.1.37
6 years ago
0.1.36
6 years ago
0.1.35
6 years ago
0.1.34
6 years ago
0.1.32
6 years ago
0.1.33
6 years ago
0.1.31
6 years ago
0.1.30
6 years ago
0.1.29
6 years ago
0.1.28
6 years ago
0.1.27
6 years ago
0.1.26
6 years ago
0.1.24
6 years ago
0.1.25
6 years ago
0.1.21
6 years ago
0.1.22
6 years ago
0.1.20
6 years ago
0.1.19
6 years ago
0.1.18
6 years ago
0.1.17
6 years ago
0.1.15
6 years ago
0.1.16
6 years ago
0.1.14
6 years ago
1.0.13
6 years ago
1.0.9
6 years ago
1.0.8
6 years ago
1.0.7
6 years ago
1.0.6
6 years ago
1.0.11
6 years ago
1.0.10
6 years ago
1.0.12
6 years ago
1.0.5
6 years ago
1.0.4
6 years ago
1.0.3
6 years ago
1.0.2
6 years ago
1.0.1
6 years ago
1.0.0
6 years ago