basant307/AI_Governance_Project
048
1type ColorFunction = (text: string) => void;2declare function yellow(text: string): string;3declare function blue(text: string): string;4declare function gray(text: string): string;5declare function red(text: string): string;6declare function green(text: string): string;7 8type colors_ColorFunction = ColorFunction;9declare const colors_blue: typeof blue;10declare const colors_gray: typeof gray;11declare const colors_green: typeof green;12declare const colors_red: typeof red;13declare const colors_yellow: typeof yellow;14declare namespace colors {15 export {16 colors_ColorFunction as ColorFunction,17 colors_blue as blue,18 colors_gray as gray,19 colors_green as green,20 colors_red as red,21 colors_yellow as yellow,22 };23}24 25type LogLevel = 'debug' | 'info' | 'success' | 'warning' | 'error';26type LogColors = keyof typeof colors;27interface LogEntry {28 timestamp: Date;29 level: LogLevel;30 message: any;31}32declare class Logger {33 private readonly name;34 private prefix;35 constructor(name: string);36 extend(domain: string): Logger;37 /**38 * Print a debug message.39 * @example40 * logger.debug('no duplicates found, creating a document...')41 */42 debug(message: any, ...positionals: Array<unknown>): void;43 /**44 * Print an info message.45 * @example46 * logger.info('start parsing...')47 */48 info(message: any, ...positionals: Array<unknown>): (message: any, ...positionals: Array<unknown>) => void;49 /**50 * Print a success message.51 * @example52 * logger.success('successfully created document')53 */54 success(message: any, ...positionals: Array<unknown>): void;55 /**56 * Print a warning.57 * @example58 * logger.warning('found legacy document format')59 */60 warning(message: any, ...positionals: Array<unknown>): void;61 /**62 * Print an error message.63 * @example64 * logger.error('something went wrong')65 */66 error(message: any, ...positionals: Array<unknown>): void;67 /**68 * Execute the given callback only when the logging is enabled.69 * This is skipped in its entirety and has no runtime cost otherwise.70 * This executes regardless of the log level.71 * @example72 * logger.only(() => {73 * logger.info('additional info')74 * })75 */76 only(callback: () => void): void;77 private createEntry;78 private logEntry;79 private formatTimestamp;80 private getWriter;81}82 83export { LogColors, LogEntry, LogLevel, Logger };84 