All files / libs/kernel/logger/server/src/lib/config logger.config.ts

0% Statements 0/14
0% Branches 0/1
0% Functions 0/1
0% Lines 0/14

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15                             
import { registerAs } from '@nestjs/config';
import * as env from 'env-var';
import { type Options } from 'pino-http';

export const loggerConfig = registerAs('logger', () => ({
  level: env.get('LOGGER_LEVEL').default('info').asString() as Options['level'],
  prettyPrint: env.get('NODE_ENV').default('development').asString() === 'development',
  enableRequestLogging: env.get('LOGGER_ENABLE_REQUEST_LOGGING').default('false').asBool(),
  enableAccessLogging: env.get('LOGGER_ENABLE_ACCESS_LOGGING').default('false').asBool(),
}));

export const LOGGER_CONFIG_KEY = loggerConfig.KEY;

export type LoggerConfig = ReturnType<typeof loggerConfig>;