UNPKG

fauna

Version:

A driver to query Fauna databases in browsers, Node.js, and other Javascript runtimes

40 lines (39 loc) 1.43 kB
export declare const LOG_LEVELS: { readonly TRACE: "0"; readonly DEBUG: "1"; readonly INFO: "2"; readonly WARN: "3"; readonly ERROR: "4"; readonly FATAL: "5"; readonly OFF: "6"; }; export type LogLevel = (typeof LOG_LEVELS)[keyof typeof LOG_LEVELS]; /** * Converts the FAUNA_DEBUG environment variable (string) into a LogLevel. * The intended use is to set FAUNA_DEBUG=0|1|2|3|4. * * This function will convert null, undefined, empty, or or any non matching * string to a LogLevel of OFF. * * @param debug_level - The String value of FAUNA_DEBUG. */ export declare function parseDebugLevel(debug_level: string | undefined): LogLevel; export interface LogHandler { trace(msg: string, ...args: any[]): void; debug(msg: string, ...args: any[]): void; info(msg: string, ...args: any[]): void; warn(msg: string, ...args: any[]): void; error(msg: string, ...args: any[]): void; fatal(msg: string, ...args: any[]): void; } export declare class ConsoleLogHandler implements LogHandler { #private; constructor(level: LogLevel); trace(msg: string, ...args: any[]): void; debug(msg: string, ...args: any[]): void; info(msg: string, ...args: any[]): void; warn(msg: string, ...args: any[]): void; error(msg: string, ...args: any[]): void; fatal(msg: string, ...args: any[]): void; } export declare function defaultLogHandler(): LogHandler;