You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 25, 2023. It is now read-only.
I am developing an application in React (using JavaScript) and I want to create a log file using the package Winston-react. I have followed their tutorial from here: https://github.com/afex-connect/winston-react#readme (obviously adapted to javascript)
Install
npm install winston-react
Usage App.js:
import React from 'react';
import winston from 'winston';
import { WinstonProvider } from 'winston-react';
const logger = winston.createLogger({
// ...
transports: [
// ...
new winston.transports.Console()
]
});
const App = () => (
<WinstonProvider logger={logger}>
<div>
your awesome application
</div>
</WinstonProvider>
);
Using hooks:
import React from 'react';
import { useWinstonLogger } from 'winston-logger';
const Component = () => {
const logger = useWinstonLogger();
React.useEffect(() => {
logger.info('your awesome information log!');
});
return (
<div>
your awesome component
</div>
);
};
But it is throwing this error: TypeError: fs.readdirSync is not a function