@towbe/react-native-log
v1.2.2
Published
A logging library to be used with react-native apps
Downloads
17
Keywords
Readme
React Native Log
Lightweight logging library for react-native
Installation
$ npm install @towbe/react-native-log
--- or ---
$ yarn add @towbe/react-native-log
Example
By default, a Log’s stream is stdout
, and its log level defaults is DEBUG
.
Instead of DEBUG
, let’s create a log with the info
level:
var Log = require('@towbe/react-native-log');
Log.debug('preparing email');
Log.info('sending email');
Log.error('failed to send email');
Change the minimum level at which to log the events:
var Log = require('@towbe/react-native-log');
Log.level = Log.ERROR
You can use %s
to pass arguments (much like console.log()
):
log.error('oh no, failed to send mail to %s.', user.email);
Log Levels
Mirror that of syslog:
ERROR
condition errorWARNING
condition warningNOTICE
condition normal, but significantINFO
a purely informational messageDEBUG
debugging information