UNPKG

winston-cloudrun

Version:
24 lines (23 loc) 854 B
import { Format } from 'logform'; import { LoggerOptions } from 'winston'; export declare type GetTraceFn = () => { traceId: string; spanId: string; traceSampled?: boolean; }; export declare type GetLabelsFn = () => Record<string, string | undefined>; export declare type WinstonCloudRunConfig = { production: boolean; getTrace?: GetTraceFn; getLabels?: GetLabelsFn; }; /** * Creates Winston format that specifies time and renames level to severity */ export declare function getCloudLoggingFormat({ getTrace, getLabels, }?: Omit<WinstonCloudRunConfig, 'production'>): Format; /** * Creates simple winston config for Cloud Run * * Log level is set like this: ```production ? 'info' : 'debug'``` */ export declare function getWinstonCloudRunConfig({ production, getTrace, getLabels, }: WinstonCloudRunConfig): LoggerOptions;