UNPKG

@ogma/nestjs-module

Version:

A NestJS module for the Ogma logger

42 lines (41 loc) 2.1 kB
import { DynamicModule } from '@nestjs/common'; import { OgmaModuleOptions, Type } from './interfaces'; import { OgmaProviderOptions } from './interfaces/ogma-provider-options.interface'; import { ASYNC_OPTIONS_TYPE } from './ogma-core.module-definition'; /** * The NestJS module for the Ogma Logger. Not much to say here */ export declare class OgmaModule { /** * Synchronous registration of the OgmaModule for NestJS. The options you can pass * are optional, and if nothing is passed the default value is `{}` * @param options The options for the OgmaModule * @returns a configured dynamic module for Nest to worry about later */ static forRoot(options?: OgmaModuleOptions): DynamicModule; /** * Asynchronous registration of the OgmaModule for NestJS. * @param options Asynchronous NestJS Module options for the OgmaModule * @returns a configured dynamic module for Nest to worry about later * @see https://dev.to/nestjs/advanced-nestjs-how-to-build-completely-dynamic-nestjs-modules-1370 */ static forRootAsync(options: typeof ASYNC_OPTIONS_TYPE): DynamicModule; /** * Creates a new OgmaService based on the given context and possible options. * Original options from the `forRoot` or `forRootAsync` options are merged with new options * * @param context string context for the OgmaService to use in logging * @param options object options in creation of OgmaService * @param options.addRequestId boolean if logger should add requestId to each log */ static forFeature(context: string | (() => any) | Type<any>, options?: OgmaProviderOptions): DynamicModule; /** * Creates several new OgmaServices based on the given contexts and possible options. * Original options from the `forRoot` or `forRootAsync` options are merged with new options */ static forFeatures(contexts: Array<{ context: string | (() => any) | Type<any>; options: OgmaProviderOptions; } | string | (() => any) | Type<any>>): DynamicModule; private static createProviders; }