Skip to content

Commit

Permalink
Merge pull request #19 from piyush-kacha/v0.0.2
Browse files Browse the repository at this point in the history
V0.0.2
  • Loading branch information
piyush-kacha authored Jun 29, 2023
2 parents d6cdaad + f069243 commit 821cfdd
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 17 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nestjs-starter-kit",
"version": "0.0.1",
"version": "0.0.2",
"description": "Nest.js with MongoDB, Express, Clustering, Swagger, Pino, Exception handling",
"main": "dist/main.js",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion src/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ import { Params } from 'nestjs-pino'; // Used to define parameters for the Pino
import { LogLevel, NodeEnv } from './shared/enums'; // Import application enums

export class AppConfig {
public static getLoggerConfig(LOG_LEVEL, NODE_ENV, CLUSTERING): Params {
public static getLoggerConfig(): Params {
// Define the configuration for the Pino logger
const { NODE_ENV, LOG_LEVEL, CLUSTERING } = process.env;

return {
exclude: [], // Exclude specific path from the logs and may not work for e2e testing
Expand Down
14 changes: 1 addition & 13 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,7 @@ import {
}),

// Configure logging
LoggerModule.forRootAsync({
imports: [ConfigModule], // Import the ConfigModule so that it can be injected into the factory function
inject: [ConfigService], // Inject the ConfigService into the factory function
useFactory: async (configService: ConfigService) => {
// Get the required configuration settings from the ConfigService
const NODE_ENV = configService.get('env');
const LOG_LEVEL = configService.get('logLevel');
const CLUSTERING = configService.get('clustering');

// Return the configuration for the logger
return AppConfig.getLoggerConfig(LOG_LEVEL, NODE_ENV, CLUSTERING);
},
}),
LoggerModule.forRoot(AppConfig.getLoggerConfig()), // ! forRootAsync is not working with ConfigService in nestjs-pino

// Configure mongoose
MongooseModule.forRootAsync({
Expand Down

0 comments on commit 821cfdd

Please sign in to comment.