import { g as RequestLogger } from "../types-B82IuY7M.mjs"; import { t as BaseMxllogOptions } from "../middleware-Cbh6eBkJ.mjs"; import { DynamicModule, MiddlewareConsumer, NestModule } from "@nestjs/common"; //#region src/nestjs/index.d.ts declare const useLogger: >() => RequestLogger; type MxllogNestJSOptions = BaseMxllogOptions; interface MxllogModuleAsyncOptions { /** Modules to import (for dependency injection into the factory) */ imports?: any[]; /** Factory function that returns mxllog options. Can be async. */ useFactory: (...args: any[]) => MxllogNestJSOptions | Promise; /** Injection tokens to resolve and pass to the factory */ inject?: any[]; } declare module 'http' { interface IncomingMessage { log?: RequestLogger; } } declare module 'express-serve-static-core' { interface Request { log?: RequestLogger; } } /** * NestJS module for mxllog wide event logging. * * Registers a global middleware that creates a request-scoped logger * for every incoming request. Use `useLogger()` to access it anywhere * in the call stack, or `req.log` directly in controllers. * * @example * ```ts * import { Module } from '@nestjs/common' * import { MxllogModule } from '@safaricom-mxl/log/nestjs' * import { createAxiomDrain } from '@safaricom-mxl/log/axiom' * * @Module({ * imports: [ * MxllogModule.forRoot({ * drain: createAxiomDrain(), * exclude: ['/health'], * }), * ], * }) * export class AppModule {} * ``` */ declare class MxllogModule implements NestModule { private static options; /** * Register mxllog with static configuration. * * @example * ```ts * MxllogModule.forRoot({ * drain: createAxiomDrain(), * enrich: (ctx) => { ctx.event.region = process.env.FLY_REGION }, * }) * ``` */ static forRoot(options?: MxllogNestJSOptions): DynamicModule; /** * Register mxllog with async configuration (e.g. from `ConfigService`). * * @example * ```ts * MxllogModule.forRootAsync({ * imports: [ConfigModule], * inject: [ConfigService], * useFactory: (config: ConfigService) => ({ * drain: createAxiomDrain({ token: config.get('AXIOM_TOKEN') }), * }), * }) * ``` */ static forRootAsync(asyncOptions: MxllogModuleAsyncOptions): DynamicModule; configure(consumer: MiddlewareConsumer): void; } //#endregion export { MxllogModule, MxllogModuleAsyncOptions, MxllogNestJSOptions, useLogger }; //# sourceMappingURL=index.d.mts.map