0.1.46 • Published 4 years ago

react-native-asoft-logger v0.1.46

Weekly downloads
2
License
MIT
Repository
-
Last release
4 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

4 years ago

0.1.44

5 years ago

0.1.45

5 years ago

0.1.43

5 years ago

0.1.41

5 years ago

0.1.42

5 years ago

0.1.40

5 years ago

0.1.38

5 years ago

0.1.39

5 years ago

0.1.37

5 years ago

0.1.36

5 years ago

0.1.35

5 years ago

0.1.34

5 years ago

0.1.32

5 years ago

0.1.33

5 years ago

0.1.31

5 years ago

0.1.30

5 years ago

0.1.29

5 years ago

0.1.28

5 years ago

0.1.27

5 years ago

0.1.26

5 years ago

0.1.24

5 years ago

0.1.25

5 years ago

0.1.21

5 years ago

0.1.22

5 years ago

0.1.20

5 years ago

0.1.19

5 years ago

0.1.18

5 years ago

0.1.17

5 years ago

0.1.15

5 years ago

0.1.16

5 years ago

0.1.14

5 years ago

1.0.13

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.12

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago