@wnqueiroz/ecs-winston
Version:
A formatter for the winston logger compatible with Elastic Common Schema (ECS) 🚀
35 lines (34 loc) • 1.31 kB
TypeScript
import { Request, Response } from 'express';
import { ECS } from './ecs.interface';
export declare namespace ECSWinston {
interface Config {
/**
* The return of this function will be defined in the fields "http.request.id" (when using req: Express and res: Express) and "trace.id".
*/
setTraceId?: () => string | null;
/**
* Defines the list of fields that should be excluded from all logs. E.g: ["http.request.headers.authorization", "http.request.body.content"].
*/
exclude?: string[];
}
namespace Log {
interface Metadata {
/**
* Defines the log in ECS format. If the defined log matches a property used in conversions it will be displayed instead.
*/
ecs?: ECS.Fields | undefined;
/**
* Defines the list of fields that should only be excluded from that log. E.g: ["http.request.headers.authorization", "http.request.body.content"].
*/
exclude?: string[];
/**
* Defines an error to be transpiled in the log. E.g.: error: new Error("foo").
*/
error?: any;
}
interface Metadata {
req?: Request;
res?: Response;
}
}
}