diff --git a/config/log.js b/config/log.js index ba1d3c7f..03060b5d 100644 --- a/config/log.js +++ b/config/log.js @@ -14,13 +14,27 @@ module.exports = (logFileName, logLevel) => { if (!winstonAttached.has(logFileName)) { winston.add(new (winston.transports.DailyRotateFile)({ filename: logFileName, - datePattern: "yyyy-MM-dd.", + datePattern: "yyyy-MM-DD", json: false, maxSize: 1000000, maxFiles: 7, level: logLevel })) - winston.add(new winston.transports.Console()) + winston.add(new winston.transports.Console({ + format: winston.format.combine( + winston.format.colorize(), + winston.format.timestamp(), + winston.format.align(), + winston.format.printf((info) => { + const { + timestamp, level, message, ...args + } = info; + + const ts = timestamp.slice(0, 19).replace('T', ' '); + return `${ts} [${level}]: ${message} ${Object.keys(args).length ? JSON.stringify(args, null, 2) : ''}`; + }), + ) + })) winston.level = logLevel winstonAttached.set(logFileName, winston) } diff --git a/yarn.lock b/yarn.lock index 324de831..32228c30 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3591,24 +3591,6 @@ isobject@^3.0.0, isobject@^3.0.1: resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= -isomorphic-webcrypto@^2.3.2: - version "2.3.4" - resolved "https://registry.yarnpkg.com/isomorphic-webcrypto/-/isomorphic-webcrypto-2.3.4.tgz#6d18ee7f795ab2f5e9fd7a5b489abaf9ee2e6af5" - integrity sha512-SnOCsm0Vls8jeWP4c26ItHFajzfDlRPcKK4YRUv6jukYGzJwl2tKNwSIAiCh1INdoRttaKhJrLc3HBer1om4HA== - dependencies: - "@peculiar/webcrypto" "^1.0.22" - asmcrypto.js "^0.22.0" - b64-lite "^1.3.1" - b64u-lite "^1.0.1" - msrcrypto "^1.5.6" - str2buf "^1.3.0" - webcrypto-shim "^0.1.4" - optionalDependencies: - "@unimodules/core" "*" - "@unimodules/react-native-adapter" "*" - expo-random "*" - react-native-securerandom "^0.1.1" - isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a"