Skip to content

Commit

Permalink
logger: better typing
Browse files Browse the repository at this point in the history
  • Loading branch information
nirnejak committed Dec 18, 2024
1 parent e6012d5 commit 1e80701
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/utils/logger.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
// eslint-disable-next-line "@typescript-eslint/no-explicit-any"
export const getLoggerConfig = (): boolean | any => {
import type { PinoLoggerOptions } from "fastify/types/logger"

export const getLoggerConfig = (): boolean | PinoLoggerOptions => {
let config: PinoLoggerOptions = {}

switch (process.env.NODE_ENV) {
case "production":
return true
case "test":
return false
case "development":
default:
return {
config = {
transport: {
target: "pino-pretty",
options: {
Expand All @@ -16,5 +19,6 @@ export const getLoggerConfig = (): boolean | any => {
},
},
}
return config
}
}

0 comments on commit 1e80701

Please sign in to comment.