We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 298fe2f commit b16fbb8Copy full SHA for b16fbb8
src/util/logger.ts
@@ -0,0 +1,18 @@
1
+import winston from 'winston';
2
+
3
+const options: winston.LoggerOptions = {
4
+ transports: [
5
+ new winston.transports.Console({
6
+ level: process.env.NODE_ENV === 'production' ? 'error' : 'debug'
7
+ }),
8
+ new winston.transports.File({ filename: 'debug.log', level: 'debug' })
9
+ ]
10
+};
11
12
+const logger = winston.createLogger(options);
13
14
+if (process.env.NODE_ENV !== 'production') {
15
+ logger.debug('Logging initialized at debug level');
16
+}
17
18
+export default logger;
0 commit comments