Browse Source

Updating logging to use rolling files

develop
Drew Short 5 years ago
parent
commit
a0639d874a
  1. 2
      .helm/Chart.yaml
  2. 2
      .helm/values.yaml
  3. 29
      package-lock.json
  4. 3
      package.json
  5. 20
      src/logging.ts

2
.helm/Chart.yaml

@ -2,4 +2,4 @@ apiVersion: v1
appVersion: "1.0"
description: A Helm chart for Kubernetes
name: baphomet-js
version: 0.1.1
version: 0.1.2

2
.helm/values.yaml

@ -17,7 +17,7 @@ app:
persistence:
accessMode: ReadWriteOnce
enabled: true
size: 10Mi
size: 50Mi
storageClass: storage
imagePullSecrets: []

29
package-lock.json

@ -461,6 +461,14 @@
"resolved": "https://registry.npmjs.org/fecha/-/fecha-2.3.3.tgz",
"integrity": "sha512-lUGBnIamTAwk4znq5BcqsDaxSmZ9nDVJaij6NvRt/Tg4R69gERA+otPKbS86ROw9nxVMw2/mp1fnaiWqbs6Sdg=="
},
"file-stream-rotator": {
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/file-stream-rotator/-/file-stream-rotator-0.5.5.tgz",
"integrity": "sha512-XzvE1ogpxUbARtZPZLICaDRAeWxoQLFMKS3ZwADoCQmurKEwuDD2jEfDVPm/R1HeKYsRYEl9PzVIezjQ3VTTPQ==",
"requires": {
"moment": "^2.11.2"
}
},
"find-up": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
@ -872,6 +880,11 @@
"yargs-unparser": "1.6.0"
}
},
"moment": {
"version": "2.24.0",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz",
"integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg=="
},
"ms": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz",
@ -892,6 +905,11 @@
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
"integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ=="
},
"object-hash": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/object-hash/-/object-hash-2.0.1.tgz",
"integrity": "sha512-HgcGMooY4JC2PBt9sdUdJ6PMzpin+YtY3r/7wg0uTifP+HJWW8rammseSEHuyt0UeShI183UGssCJqm1bJR7QA=="
},
"object-inspect": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.7.0.tgz",
@ -1356,6 +1374,17 @@
"winston-transport": "^4.3.0"
}
},
"winston-daily-rotate-file": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/winston-daily-rotate-file/-/winston-daily-rotate-file-4.4.1.tgz",
"integrity": "sha512-516bL4IDjgX5mPEsTPXNVNzZtJkrUFY2IvPhj8n5xSKyy804xadp4TUlhxEZLL/Jbs8CF+rESfq95QXFLFTzKA==",
"requires": {
"file-stream-rotator": "^0.5.5",
"object-hash": "^2.0.1",
"triple-beam": "^1.3.0",
"winston-transport": "^4.2.0"
}
},
"winston-transport": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/winston-transport/-/winston-transport-4.3.0.tgz",

3
package.json

@ -15,7 +15,8 @@
"matrix-js-sdk": "2.4.5",
"showdown": "^1.9.1",
"trie-prefix-tree": "^1.5.1",
"winston": "^3.2.1"
"winston": "^3.2.1",
"winston-daily-rotate-file": "^4.4.1"
},
"devDependencies": {
"@types/node": "^13.1.6",

20
src/logging.ts

@ -1,4 +1,20 @@
let winston = require('winston');
require('winston-daily-rotate-file');
let errorTransport = new (winston.transports.DailyRotateFile)({
level: 'error',
filename: 'error-%DATE%.log',
datePattern: 'YYYY-MM-DD',
zippedArchive: true,
maxFiles: '7d'
});
let combinedTransport = new (winston.transports.DailyRotateFile)({
filename: 'combined-%DATE%.log',
datePattern: 'YYYY-MM-DD',
zippedArchive: true,
maxFiles: '7d'
});
let logger = winston.createLogger({
level: 'info',
@ -9,8 +25,8 @@ let logger = winston.createLogger({
),
defaultMeta: { service: 'baphomet-js' },
transports: [
new winston.transports.File({ filename: 'log/error.log', level: 'error' }),
new winston.transports.File({ filename: 'log/combined.log' })
errorTransport,
combinedTransport
]
});

|||||||
100:0
Loading…
Cancel
Save