Skip to content

Commit

Permalink
feat: pino logger with prettyPrint
Browse files Browse the repository at this point in the history
  • Loading branch information
dockfries committed Sep 3, 2022
1 parent 5dca7c9 commit 7f75ac3
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 11 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "omp-node-lib",
"version": "0.0.6",
"version": "0.0.7",
"description": "Better with omp-node-ts",
"main": "dist/bundle.js",
"types": "dist/bundle.d.ts",
Expand Down Expand Up @@ -42,6 +42,7 @@
"iconv-lite": "^0.6.3",
"lodash": "^4.17.21",
"omp-wrapper": "latest",
"pino": "^8.4.2"
"pino": "^8.4.2",
"pino-pretty": "^9.1.0"
}
}
122 changes: 114 additions & 8 deletions pnpm-lock.yaml

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

8 changes: 7 additions & 1 deletion src/controllers/logger/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ export default class Logger {
private static instance: PinoLogger | null = null;
private constructor() {}
public static getInstance() {
if (!Logger.instance) Logger.instance = pino();
if (!Logger.instance)
Logger.instance = pino({
prettyPrint: {
translateTime: "SYS:yyyy-mm-dd HH:MM:ss",
ignore: "pid,hostname",
},
});
return Logger.instance;
}
}

0 comments on commit 7f75ac3

Please sign in to comment.