0.0.9 • Published 5 months ago

otostogan-nest-logger v0.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Description

Nest utility module for multi level logging. Includes logging in Nest Console, Logs Files and Grafana Loki

Installation

$ npm install otostogan-nest-logger

Logger Config

import { ConfigModule, ConfigService } from '@nestjs/config';
import { ILoggerModuleAsyncOptions } from 'otostogan-nest-logger';

export const getLoggerConfig = (): ILoggerModuleAsyncOptions => ({
  inject: [ConfigService],
  imports: [ConfigModule],
  useFactory: (configService: ConfigService) => ({
    APP_NAME: configService.get('APP_NAME') ?? 'API',
    LOG_PATH: `${process.cwd()}/publisher/${configService.get('APP_NAME')}`,
    LOKI_HOST: configService.get<string>('LOKI_URL'),
  }),
});

Declaring Logger Module

@Module({
  imports: [
    ConfigModule.forRoot({ envFilePath: '.env', isGlobal: true }),
	LogModule.forRootAsync(getLoggerConfig()),
  ],
  exports: [LogModule],
})
export class SetupConfigModule {}

Support

otostogan-nest-logger is an open source project. It can grow thanks to the sponsors and support by the amazing backers.

0.0.9

5 months ago

0.0.8

5 months ago

0.0.7

5 months ago

0.0.6

5 months ago

0.0.5

5 months ago

0.0.4

5 months ago

0.0.3

5 months ago

0.0.2

5 months ago

0.0.1

5 months ago