UNPKG

@accordproject/concerto-util

Version:

Utilities for Concerto Modeling Language

87 lines (86 loc) 2.56 kB
/** * Default levels for the npm configuration. */ declare const levels: Record<string, number>; /** * The default transport for logging at multiple levels to the console * @param level - the required log level. e.g. error, warn, info, debug, etc. * @param args - the input obj to prettify */ type LogLevel = keyof typeof levels; type Transport = Partial<Record<LogLevel, (...args: unknown[]) => void>>; /** * A utility class with static function that print to the console */ declare class Logger { static level: string; static transports: Transport[]; /** * A reusable function for logging at multiple levels * @param level - the required log level. e.g. error, warn, info, debug, etc. * @param args - the input obj to prettify */ static dispatch(level: LogLevel, ...args: unknown[]): void; /** * Add a custom transport for logging * @param transport - The transport object should have function for the usual logging operations e.g. error, warn, info, debug, etc. */ static add(transport: Transport): void; /** * Write an error statement to the console. * * Prints to `stderr` with newline. * @param args - args */ static error(...args: unknown[]): void; /** * Write a warning statement to the console. * * Prints to `stderr` with newline. * @param args - args */ static warn(...args: unknown[]): void; /** * Write an info statement to the console. * * Prints to `stdout` with newline. * @param args - args */ static info(...args: unknown[]): void; /** * Write an info statement to the console. Alias for `logger.log` * * Prints to `stdout` with newline. * @param args - args */ static log(...args: unknown[]): void; /** * Write an http statement to the console. * * Prints to `stdout` with newline. * @param args - args */ static http(...args: unknown[]): void; /** * Write a verbose log statement to the console. * * Prints to `stdout` with newline. * @param args - args */ static verbose(...args: unknown[]): void; /** * Write a debug statement to the console. * * Prints to `stdout` with newline. * @param args - args */ static debug(...args: unknown[]): void; /** * Write a silly level statement to the console. * * Prints to `stdout` with newline. * @param args - args */ static silly(...args: unknown[]): void; } export = Logger;