UNPKG

@bsv/wallet-toolbox-client

Version:
65 lines 2.54 kB
import { CreateActionArgs, WalletLoggerInterface, WalletLoggerLog } from '@bsv/sdk'; export declare class WalletLogger implements WalletLoggerInterface { indent: number; logs: WalletLoggerLog[]; isOrigin: boolean; isError: boolean; level?: WalletLoggerLevel; flushFormat?: 'json'; constructor(log?: string | WalletLoggerInterface); private logAny; private toAdd; private stampLog; group(...label: any[]): void; groupEnd(): void; log(message?: any, ...optionalParams: any[]): void; error(message?: any, ...optionalParams: any[]): void; toWalletLoggerJson(): object; toLogString(): string; flush(): object | undefined; merge(log: WalletLoggerInterface): void; } export declare function logWalletError(eu: unknown, logger?: WalletLoggerInterface, label?: string): void; export declare function logCreateActionArgs(args: CreateActionArgs): object; /** * Optional. Logging levels that may influence what is logged. * * 'error' Only requests resulting in an exception should be logged. * 'warn' Also log requests that succeed but with an abnormal condition. * 'info' Also log normal successful requests. * 'debug' Add input parm and result details where possible. * 'trace' Instead of adding debug details, focus on execution path and timing. */ export type WalletLoggerLevel = 'error' | 'warn' | 'info' | 'debug' | 'trace'; /** * Constructor properties available to `WalletLogger` */ export interface WalletLoggerArgs { /** * Optional. Logging levels that may influence what is logged. * * 'error' Only requests resulting in an exception should be logged. * 'warn' Also log requests that succeed but with an abnormal condition. * 'info' Also log normal successful requests. * 'debug' Add input parm and result details where possible. * 'trace' Instead of adding debug details, focus on execution path and timing. */ level?: 'error' | 'warn' | 'info' | 'debug' | 'trace'; /** * Valid if an accumulating logger. Count of `group` calls without matching `groupEnd`. */ indent?: number; /** * True if this is an accumulating logger and the logger belongs to the object servicing the initial request. */ isOrigin?: boolean; /** * True if this is an accumulating logger and an error was logged. */ isError?: boolean; /** * Optional array of accumulated logged data and errors. */ logs?: WalletLoggerLog[]; } //# sourceMappingURL=WalletLogger.d.ts.map