UNPKG

@rasla/logify

Version:

A lightweight, flexible, and easy-to-use logging middleware for Elysia.js applications

49 lines (48 loc) 1.23 kB
import { Elysia } from "elysia"; import { LoggerOptions } from "./types"; /** * HTTP logger middleware for Elysia. * * This now logs ONLY HTTP request/response cycles with its own (http) logger instance * allowing the global logger (initialized via `initializeLogger`) to be used for * application / business logs with a different format. * * To preserve previous behaviour (middleware configuring & using the global logger) * pass `{ useGlobal: true }`. */ export declare function logger(options?: LoggerOptions): Elysia<"", { decorator: {}; store: {}; derive: { readonly startTime: number; readonly clientIp: string; readonly errorLogged: false; }; resolve: {}; }, { typebox: {}; error: {}; }, { schema: {}; standaloneSchema: {}; macro: {}; macroFn: {}; parser: {}; response: import("elysia").ExtractErrorFromHandle<{ readonly startTime: number; readonly clientIp: string; readonly errorLogged: false; }>; }, {}, { derive: {}; resolve: {}; schema: {}; standaloneSchema: {}; response: {}; }, { derive: {}; resolve: {}; schema: {}; standaloneSchema: {}; response: {}; }>;