0.1.46 • Published 3 years ago

react-native-asoft-logger v0.1.46

Weekly downloads
2
License
MIT
Repository
-
Last release
3 years ago

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 --save

Example 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

3 years ago

0.1.44

4 years ago

0.1.45

4 years ago

0.1.43

4 years ago

0.1.41

4 years ago

0.1.42

4 years ago

0.1.40

4 years ago

0.1.38

4 years ago

0.1.39

4 years ago

0.1.37

4 years ago

0.1.36

4 years ago

0.1.35

4 years ago

0.1.34

4 years ago

0.1.32

4 years ago

0.1.33

4 years ago

0.1.31

4 years ago

0.1.30

4 years ago

0.1.29

4 years ago

0.1.28

4 years ago

0.1.27

4 years ago

0.1.26

4 years ago

0.1.24

4 years ago

0.1.25

4 years ago

0.1.21

4 years ago

0.1.22

4 years ago

0.1.20

4 years ago

0.1.19

4 years ago

0.1.18

4 years ago

0.1.17

4 years ago

0.1.15

4 years ago

0.1.16

4 years ago

0.1.14

4 years ago

1.0.13

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.11

4 years ago

1.0.10

4 years ago

1.0.12

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago