butlerx
5 years ago
No known key found for this signature in database
GPG Key ID: B37CA765BAA89170
2 changed files with
11 additions and
7 deletions
-
package.json
-
src/server/utils/logger.ts
|
|
@ -23,7 +23,7 @@ |
|
|
|
"dev": "NODE_ENV=development concurrently --kill-others --success first \"babel-node node_modules/.bin/webpack --watch\" \"nodemon .\"", |
|
|
|
"lint": "eslint --ext .ts,.js .", |
|
|
|
"prepublishOnly": "NODE_ENV=production yarn build", |
|
|
|
"start": "node .", |
|
|
|
"start": "NODE_ENV=production node .", |
|
|
|
"test": "mocha -r babel-register-ts src/**/*.spec.ts" |
|
|
|
}, |
|
|
|
"husky": { |
|
|
|
|
|
@ -2,13 +2,17 @@ import { createLogger, format, transports } from 'winston'; |
|
|
|
|
|
|
|
const { combine, timestamp, label, simple, json, colorize } = format; |
|
|
|
|
|
|
|
const dev = combine( |
|
|
|
colorize(), |
|
|
|
label({ label: 'Wetty' }), |
|
|
|
timestamp(), |
|
|
|
simple() |
|
|
|
); |
|
|
|
|
|
|
|
const prod = combine(label({ label: 'Wetty' }), timestamp(), json()); |
|
|
|
|
|
|
|
const logger = createLogger({ |
|
|
|
format: combine( |
|
|
|
colorize({ all: process.env.NODE_ENV === 'development' }), |
|
|
|
label({ label: 'Wetty' }), |
|
|
|
timestamp(), |
|
|
|
process.env.NODE_ENV === 'development' ? simple() : json() |
|
|
|
), |
|
|
|
format: process.env.NODE_ENV === 'development' ? dev : prod, |
|
|
|
transports: [ |
|
|
|
new transports.Console({ |
|
|
|
level: process.env.NODE_ENV === 'development' ? 'debug' : 'info', |
|
|
|