-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: logger #32
feat: logger #32
Changes from 4 commits
07b28d4
8c891e4
51114f0
ac2b938
b684b8f
9658bd7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export * from "./types"; | ||
export * from "./logger"; | ||
export * from "./constants"; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./logger.module"; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Module } from "@nestjs/common"; | ||
import { WinstonModule } from "nest-winston"; | ||
import * as winston from "winston"; | ||
|
||
@Module({ | ||
imports: [ | ||
WinstonModule.forRoot({ | ||
transports: [ | ||
new winston.transports.Console({ | ||
format: winston.format.combine( | ||
winston.format.timestamp({ | ||
format: "YYYY-MM-DD HH:mm:ss", | ||
}), | ||
winston.format.errors({ stack: true }), | ||
winston.format.colorize(), | ||
winston.format.printf( | ||
({ timestamp, level, message, stack }: Record<string, string>) => { | ||
return `${timestamp} ${level}: ${stack || message}`; | ||
}, | ||
), | ||
), | ||
}), | ||
], | ||
}), | ||
], | ||
exports: [WinstonModule], | ||
}) | ||
export class LoggerModule {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,9 +28,11 @@ | |
"@nestjs/platform-express": "10.0.0", | ||
"@nestjs/swagger": "7.4.0", | ||
"abitype": "1.0.5", | ||
"nest-winston": "^1.9.7", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove caret There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was curious if
|
||
"reflect-metadata": "0.1.13", | ||
"rxjs": "7.8.1", | ||
"viem": "2.17.5" | ||
"viem": "2.17.5", | ||
"winston": "^3.13.1" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove caret |
||
}, | ||
"devDependencies": { | ||
"@commitlint/config-conventional": "19.2.2", | ||
|
@@ -44,10 +46,10 @@ | |
"@types/jest": "29.5.2", | ||
"@types/node": "20.3.1", | ||
"@types/supertest": "6.0.0", | ||
"@typescript-eslint/eslint-plugin": "7.0.0", | ||
"@typescript-eslint/parser": "7.0.0", | ||
"@typescript-eslint/eslint-plugin": "7.18.0", | ||
"@typescript-eslint/parser": "7.18.0", | ||
"commitlint": "19.3.0", | ||
"eslint": "8.42.0", | ||
"eslint": "8.56.0", | ||
"eslint-config-prettier": "9.0.0", | ||
"eslint-plugin-prettier": "5.0.0", | ||
"husky": "9.0.11", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just in case, here
stack == ""
will causemessage
to be printed.