@ima/dev-utils
Version:
IMA.js dev utils used used mainly in @ima/cli and other dev-related utilities.
39 lines (38 loc) • 1.34 kB
TypeScript
export interface LoggerOptions {
trackTime?: boolean;
newLine?: boolean;
elapsed?: ReturnType<typeof time>;
}
/**
* Returns time utility function, which when called returns
* formatted elapsed time from it's creation.
*
* @returns {() => string} Callback to return formatted elapsed time.
*/
export declare function time(): () => string;
/**
* Prints current time in HH:MM:SS format.
*/
export declare function printTime(): string;
export declare class Logger {
#private;
innerElapsed?: ReturnType<typeof time>;
constructor(identifier?: string, globalLogger?: Logger);
endTracking(): void;
info(message: string, options?: LoggerOptions): void;
success(message: string, options?: LoggerOptions): void;
error(message: string | Error, options?: LoggerOptions): void;
warn(message: string, options?: LoggerOptions): void;
sync(message: string, options?: LoggerOptions): void;
plugin(message: string, options?: LoggerOptions): void;
write(message: string, options?: LoggerOptions): void;
writeElapsed(elapsed: ReturnType<typeof time>): void;
setSilent(isSilent: boolean): void;
isSilent(): boolean;
}
/**
* Create global logger instance
*/
declare const globalLogger: Logger;
export { globalLogger as logger };
export declare function createLogger(name: string): Logger;