diff --git a/src/app.module.ts b/src/app.module.ts index 0d4055d..67ebd78 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -20,11 +20,10 @@ import { v4 as uuidv4 } from 'uuid'; imports: [ConfigModule], inject: [ConfigService], useFactory: async (config: ConfigService) => { - const level = config.get('general.debug') ? 'debug' : 'info'; return { - level, + level: config.get('general.loglevel'), pinoHttp: { - level, + level: config.get('general.loglevel'), genReqId: (request) => request.headers['x-correlation-id'] || uuidv4(), transport: config.get('general.pretty') diff --git a/src/config/schema/config.schema.ts b/src/config/schema/config.schema.ts index 26eadb2..e0a0ae1 100644 --- a/src/config/schema/config.schema.ts +++ b/src/config/schema/config.schema.ts @@ -14,12 +14,12 @@ export const schema: convict.Schema = { env: 'PORT', arg: 'port', }, - debug: { - doc: 'Enable debug logging', - format: 'Boolean', - default: false, - env: 'DEBUG', - arg: 'debug', + loglevel: { + doc: 'Set the log level', + format: 'String', + default: 'error', + env: 'LOG_LEVEL', + arg: 'loglevel', }, pretty: { doc: 'Enable pretty logging',