@actyx/sdk
Version:
Actyx SDK
59 lines (58 loc) • 1.77 kB
TypeScript
/**
* Generic logging function signature.
* @public
*/
export declare type LogFunction = (first: any, ...rest: any[]) => void;
/**
* A concrete logger that has a namespace and a flag indicating whether
* it’s enabled or logged messages will just be silently swallowed.
*/
export interface Logger extends LogFunction {
readonly namespace: string;
readonly enabled: boolean;
}
/**
* A collection of loggers of different severity for a fixed topic.
*/
export declare type Loggers = {
error: Logger;
warn: Logger;
debug: Logger;
info: Logger;
};
/**
* Loggers which just buffer messages.
*/
export declare type TestLoggers = {
errors: string[];
warnings: string[];
error: Logger;
warn: Logger;
debug: Logger;
info: Logger;
};
export declare const mkTestLoggers: () => TestLoggers;
export declare const mkLogger: (topic: string, logFnOverride?: LogFunction | undefined) => Logger;
export declare const mkLoggers: (topic: string) => Loggers;
export declare type LogLeech = (namespace: string, first: any, ...rest: any[]) => void;
export declare const globalLogLeech: LogLeech;
export declare const LoggersInternal: {
globalLogLeech: LogLeech;
testLoggers: () => TestLoggers;
};
/** Loggers associated methods.
* @public */
export declare const Loggers: {
of: (topic: string) => Loggers;
};
/**
* Build logging pattern for consumption by the `debug` library.
* @public
*/
export declare const makeLogPattern: (excludeModules: string[]) => string;
/**
* Utility function to enable all logging with exception for passed in logger namespaces.
* For excluded logger namespaces errors will still be logged!
* @public
*/
export declare const enableAllLoggersExcept: (excludeModules: string[]) => void;