import { Console } from "console"; import FileManager from "./FileManager"; declare type event = (symbol | string); declare type eventNS = string | event[]; interface ListenerFn { (...values: any[]): void; } import { ConsoleEvents, FormatterFunc, KufaOptions, MemoryFunc, ParserFunc } from "../types/"; export interface KufaConsole { on(event?: E, listener?: ConsoleEvents[E]): this; on(event: string, listener: ListenerFn, options?: boolean): this; } /** * Kufa Console Manager */ export declare class KufaConsole extends Console { /** * @typedef {Object} KufaOptions * @property {string} timeZone The time zone of the message * @property {boolean} onlyHours If you want the day to appear in the message * @property {boolean} save Value that handles if messages will be saved in files * @property {boolean} traceFun Value to define if they will be shown from where the message function was called * @property {string} dir Directory where messages are stored if you wish * @property {string} format It is the format in which the logs will be sent * @property {string} log_prefix what the LOG text will look like in the message * @property {string} warn_prefix what the WARN text will look like in the message * @property {string} error_prefix what the ERROR text will look like in the message * @property {ParserFunc} parser It will go through this function first before sending the message (a Context parameter is sent to the function) * @property {MemoryFunc} memoryFun In case you have another way to obtain the use of the ram you can put the function here * @property {Array} formatters The message before being sent to the parser will go through here to give the message styles * @property {Array} traceFilters Filters to avoid certain callsites from being shown (RegExp) * @property {number} maxMb The maximum amount of size that log files can have * @memberof KufaConsole */ /** * @param {KufaOptions} [options] Kufa configuration options */ readonly timeZone?: string; readonly onlyHours?: boolean; readonly ws?: string; readonly save?: boolean; readonly traceFun?: boolean; readonly clientID?: string; readonly memoryFun?: MemoryFunc; private dir_; readonly format: string; readonly log_prefix: string; readonly warn_prefix: string; readonly error_prefix: string; private events?; readonly depth: number; readonly parser?: ParserFunc; readonly formatters?: FormatterFunc[]; readonly traceFilters?: RegExp[]; readonly maxMb: number; readonly fileManager?: FileManager; constructor(options?: KufaOptions); emit(event: event | eventNS, ...args: any): void; /** * Custom log * @params {any} Arguments to be sent to the console * @returns {Promise} */ log(...args: any): void; /** * Custom error * @params {any} Arguments to be sent to the console * @returns {Promise} */ error(...args: any): void; /** * Custom warn * @params {any} Arguments to be sent to the console * @returns {Promise} */ warn(...args: any): void; /** * Function to save logs in files * @param {string} type * @param {string} str * @returns {Promise} * @private */ /** * Original console.log * @params {any} Arguments to be sent to the console * @returns {null} */ _oldLog(...args: any): void; /** * Original console.warn * @params {any} Arguments to be sent to the console * @returns {null} */ _oldWarn(...args: any): void; /** * Original console.error * @params {any} Arguments to be sent to the console * @returns {null} */ _oldError(...args: any): void; } export default KufaConsole;