Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Logging in react-native using winston

I am trying to use winston in my react-native app for logging errors and other things in runtime. But after installing winston it gives me following error

`Unable to resolve module crypto
 Unable to resolve module cycle
 Unable to resolve module fs`

Is winston even compatible with react-native?

like image 403
Prakash Avatar asked May 17 '17 08:05

Prakash


People also ask

What is Winston logging?

Winston is the most popular logging library for Node. js. It aims to make logging more flexible and extensible by decoupling different aspects such as log levels, formatting, and storage so that each API is independent and many combinations are supported. It also uses Node.

How do you perform logging in react-native?

Note that as of React Native 0.29 and later, you can get logs without running the debugger. Just run react-native log-ios or react-native log-android on the command line inside your project folder. And when you open the Remote JS Debugging, you have to press option+command+i and check the console.

How do I change the log level in Winston?

const winston = require('winston'); // ... winston. level = 'debug'; will set the log level to 'debug'.


1 Answers

So, I found out that winston is not supported in react native. So, now i have implemented a customised logging system.

Answered this so that no one wastes there time with winston if working on react native

like image 145
Prakash Avatar answered Oct 21 '22 01:10

Prakash