import { UniDuration } from '@ehmpathy/uni-time'; import type { LogLevel } from 'simple-leveled-log-methods'; import { VisualogicContext } from '../domain/constants'; /** * enables input output logging and tracing for a method * * todo: - add tracing identifier w/ async-context * todo: - hookup visual tracing w/ external lib (vi...lo...) * todo: - bundle this with its own logging library which supports scoped logs */ export declare const withLogTrail: (logic: (input: TInput, context: TContext) => TOutput, { name: declaredName, log: logOptions, duration, }: { /** * specifies the name of the function, if the function does not have a name assigned already */ name?: string | undefined; /** * enable redacting parts of the input or output from logging */ log?: { /** * specifies the level to log the trail with * * note: * - defaults to .debug // todo: debug to .trail */ level?: LogLevel | undefined; /** * what of the input to log */ input?: ((input: TInput, context: TContext) => any) | undefined; /** * what of the output to log */ output?: ((value: Awaited) => any) | undefined; /** * what of the error to log */ error?: ((error: Error) => any) | undefined; } | undefined; /** * specifies the threshold after which a duration will be included on the output log */ duration?: { threshold: UniDuration; } | undefined; }) => (input: TInput, context: TContext) => TOutput;