diff --git a/backend/.env.example b/backend/.env.example index 24ff36dd..990438ec 100644 --- a/backend/.env.example +++ b/backend/.env.example @@ -33,4 +33,6 @@ AWS_S3_BUCKET_NAME_PUBLIC= ENCRYPTION_KEY= -ONGHUB_URL= \ No newline at end of file +ONGHUB_URL= + +LOGGING_LEVEL= \ No newline at end of file diff --git a/backend/src/common/config/logging.config.ts b/backend/src/common/config/logging.config.ts index dee0a2cb..ab4e2afa 100644 --- a/backend/src/common/config/logging.config.ts +++ b/backend/src/common/config/logging.config.ts @@ -1,6 +1,19 @@ -export const PinoLoggerConfig = { +import * as dotenv from 'dotenv'; +import { Params as PinoLoggerParams, PinoLogger } from 'nestjs-pino'; +dotenv.config(); + +// Possible loggin levels, from quiet to verbose +export type LOGGING_LEVEL = + | 'fatal' + | 'error' + | 'warn' + | 'info' + | 'debug' + | 'trace'; + +export const PinoLoggerConfig: PinoLoggerParams = { pinoHttp: { - level: 'trace', + level: process.env.LOGGING_LEVEL || 'trace', autoLogging: { ignore: (req) => { return req.url.includes('health');