@kwiz/common
Version:
KWIZ common utilities and helpers for M365 platform
40 lines (39 loc) • 2.1 kB
TypeScript
import { ConsoleLogger, logMessageValue } from './utils/consolelogger';
/** to be used by 3rd party apps to get the latet project config. Main project entry point will have to call config. */
export declare class CommonLogger {
private name;
constructor(name: string);
private instance;
get i(): ConsoleLogger;
debug(message: any): void;
info(message: any): void;
log(message: any): void;
/** output a message when debug is off */
warn(message: any): void;
/** output a message when debug is off */
error(message: any): void;
/** output a message when debug is off */
trace(message: any): void;
/**start timer on a label, call timeEnd with the same label to print out the time that passed */
time(label: string): void;
/**start timer on a label, call timeEnd with the same label to print out the time that passed */
timeEnd(label: string): void;
/**prints an array or dictionary to the console inside a group */
table(data: any, groupLabel?: string, groupCollapsed?: boolean): void;
/**prints a JSON object to the console inside a group */
json(data: any, groupLabel?: string, groupCollapsed?: boolean): void;
/**prints an XML object to the console inside a group. If data is string that looks like an XML - will try to parse it. */
xml(data: any, groupLabel?: string, groupCollapsed?: boolean): void;
/** render messages inside a group, and closes the group when done. if a label is not provided - a group will not be rendered */
group(renderContent: () => void, label?: string, collapsed?: boolean): void;
groupSync<ReturnType>(label: string, renderContent: (log: (message: logMessageValue) => void) => ReturnType, options?: {
expand?: boolean;
/** do not write to log */
supress?: boolean;
}): ReturnType;
groupAsync<ReturnType>(label: string, renderContent: (log: (message: logMessageValue) => void) => Promise<ReturnType>, options?: {
expand?: boolean;
/** do not write to log */
supress?: boolean;
}): Promise<ReturnType>;
}