react-native-log-screen
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Features

  • Colored logging to your console and easy to integration in your customerized component.

  • Different log levels

  • Log in Memory/Storage

  • Using Rxjs observer and subscriber to track logs.

Usage

  1. Initial logger only once when your application init.
    LoggerFactory.createLogger({
            logToConsole:true
     },
    LOG_STORAGE_TYPE.LOCALSTORAGE)

LOG_STORAGE_TYPE can be LOCALSTORAGE & MEMORY

  • LoggerOptions can be use to integration other log instance, please use logToConsoleFunc as logger callback.
     LoggerOptions {
        logToConsole: boolean
        logToConsoleFunc?: (message: any, ...optionalParams: any[]) => void
    }
  1. Use logger
  • Initial LoggerFactory
  • Subscribe logger E.g
   logger.subscribe(message => {
         // eslint-disable-next-line react/no-access-state-in-setstate
         this.setState({ logData: [...this.state.logData, message] })
       })
  • Use logger the same as console.log logger.debug() logger.info() etc.
  1. Example Please refer to LoggerPage.ts

Dependents (0)

Package Sidebar

Install

npm i react-native-log-screen

Weekly Downloads

6

Version

1.0.4

License

MIT

Unpacked Size

668 kB

Total Files

80

Last publish

Collaborators

  • vurtnec