/** * LOGGING FUNCTIONS =========================================================== * ============================================================================= */ /** * Benchmark provided function with optional logging of its output * * @example * bench({type: SET, loop: 10000}, performStorage, SET, 'id', [13]) * >>> performStorage() ▶ SET took 1,912.790 ms for 10,000 iterations, 0.191 ms each * * @param {string} [type] - name of benchmark type (i.e. `selector`, `query`, etc.) * @param {Function|string|boolean} [log] - wrapper function or property path of the result to log, * use `true` to log result itself * @param {string} [name] - the benched function name * @param {number} [loop] - number of iterations to run the function * @param {Function} func - to benchmark * @param {*} args - arguments to pass to the function * @return {*} - result as processed by given `log` argument, if any */ export function bench({ type, log, name, loop }?: string | undefined, func: Function, ...args: any): any; export namespace bench { const skip: Function; } /** * Asynchronous Benchmark Version * @Note: see bench() method for documentation */ export function benchA({ type, log, name, loop }: { type: any; log: any; name: any; loop: any; }, func: any, ...args: any[]): Promise; export namespace benchA { const skip_1: Function; export { skip_1 as skip }; } /** * Console log proxy method which provides a way to prepend the log with the first param * and also pass colors via the ...args array. Only runs in dev. * * @requires __DEV__ * @param {string} first - string to prepend to the log message * @param {*} [args] - optionally pass additional arguments to log * @return void */ export function log(first: string, ...args?: any): void; /** * Console log proxy method to show Benchmark stats * * @param {string} name - the calling function name * @param {string} [type] - the calling function type * @param {number} duration - milliseconds it took to execute * @param {number} [loop] - execution iterations * @param {*} result - execution result * @return void */ export function logBenchmark({ name, type, duration, loop, result }: string): void; /** * Console log proxy for Component props mapping from State with standardised colors and format. * Only runs in dev. * * @requires __DEV__ * @param {string} NAME - View Template's name * @param {*} value - Mapping result to log * @return void */ export function logMapping(NAME: string, value: any): void; /** * React Component Log Render Decorator * @example: * @logRender * class Homepage extends Component {...} * >>> ♦♦♦♦♦♦♦ RENDER Homepage ♦♦♦♦♦♦♦ * * @param {Object} constructor - class */ export function logRender(constructor: Object): Object; /** * Console log proxy for memoized Selectors with standardised colors and format. * Only runs in dev. * * @requires __DEV__ * @param {string} NAME - Selector function name * @param {*} value - Selector value to log * @param {*} [args] - other arguments to pass * @return void */ export function logSelector(NAME: string, value: any, ...args?: any): void; /** * Console log proxy for non-cached state Queries with standardised colors and format. * Only runs in dev. * * @requires __DEV__ * @param {string} NAME - Query function name * @param {*} value - value to log * @return void */ export function logQuery(NAME: string, value: any): void; /** * Console log proxy for async Tasks with standardised colors and format. * Only runs in dev. * * @requires __DEV__ * @param {string} NAME - Task function name * @param {*} value - Task value to log * @return void */ export function logTask(NAME: string, value?: any): void; /** * Console log proxy for Tests with standardised colors and format. * Only runs in test. * * @requires __TEST__ * @return void */ export function logTest(...args: any[]): void; /** * Clear Console Log */ export function logClear(): void; /** * Console warn proxy method. Only runs in dev. * * @requires __DEV__ * @param {*} args - the arguments to log * @return void */ export function warn(...args: any): void; /** * Ensure the program only runs in the frontend client side */ export function assertFrontend(): void; /** * Ensure the program only runs in the backend server */ export function assertBackend(): void;