Skip to content

Commit

Permalink
feat: add new logger
Browse files Browse the repository at this point in the history
- using `log4js`
  • Loading branch information
Chinlinlee committed Mar 28, 2022
1 parent 0493463 commit 2fcf6a3
Show file tree
Hide file tree
Showing 4 changed files with 177 additions and 12 deletions.
15 changes: 15 additions & 0 deletions config/log4js.default.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"appenders": {
"console": {
"type": "console"
}
},
"categories": {
"default": {
"appenders": [
"console"
],
"level": "DEBUG"
}
}
}
166 changes: 154 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"joi": "^17.2.1",
"jsonwebtoken": "^8.5.1",
"lodash": "^4.17.21",
"log4js": "^6.4.4",
"moment": "^2.24.0",
"mongoose": "^5.13.5",
"mongoose-schema-jsonschema": "^1.4.7",
Expand Down
7 changes: 7 additions & 0 deletions utils/log.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const fs = require('fs');
const path = require('path');
const { configure, getLogger } = require('log4js');
configure(path.join(__dirname, "../config/log4js.default.json"));
let raccoonLogger = getLogger();

module.exports.logger = raccoonLogger;

0 comments on commit 2fcf6a3

Please sign in to comment.