UNPKG

@abw/badger-database

Version:
62 lines 2.51 kB
export declare function Debugger(enabled: boolean, prefix: string, color: string): any; export declare function addDebug(obj: object, enabled: boolean, prefix?: string, color?: string): void; /** * @ignore * Default debugging options */ export type DebugSetting = { debug: boolean; prefix?: string; color?: string; debugPrefix?: string; debugColor?: string; }; export type DebugComponent = 'database' | 'engine' | 'query' | 'tables' | 'table' | 'record' | 'builder' | 'transaction' | 'test'; export declare let debug: Record<DebugComponent, DebugSetting>; export type DebugOption = boolean | Partial<DebugSetting>; /** * Function to set debugging options. Each key in the `options` should be * one of the components that supports debugging: `database`, `engine`, * `queries`, etc. The corresponding values should either be boolean values * to enable or disable debugging for the option, or an object containing a * `debug` flag, and optionally, a `prefix` and/or `color`. * @example * setDebug({ engine: true }) * @example * setDebug({ * engine: { * debug: true, * prefix: 'Choo Choo!', * color: 'green' * } * }) */ export declare const setDebug: (options: Partial<Record<DebugComponent, DebugOption>>) => void; /** * Function to get debugging options for one of the components that supports * debugging: `database`, `engine`, `queries`, `table`, etc. One or more * additional objects can be passed that contain further configuration * options. The returned object will contained a merged set of the defaults * and those options. * @example * getDebug('engine') * @example * getDebug('engine', { debug: true }) * @example * getDebug('engine', { debug: true, color: 'green' }) * @example * getDebug('engine', { debug: true }, { color: 'green' }) */ export declare const getDebug: (name: DebugComponent, ...configs: Partial<DebugSetting>[]) => DebugSetting; /** * Function to add the `debug()` and `debugData()` methods to an object. * The `name` should be the name of a debug component, e.g. `database`, * `engine`, `queries`, `table`, etc. One or more additional objects can * be passed that contain further configuration options. * @example * addDebugMethod(myObject, 'engine', { debug: true }) * @example * getDebug(myObject, 'engine', { debug: true }, { color: 'green' }) */ export declare const addDebugMethod: (object: object, name: DebugComponent, ...configs: DebugSetting[]) => void; //# sourceMappingURL=Debug.d.ts.map