UNPKG

@adapty/capacitor

Version:
35 lines (34 loc) 1.47 kB
import { LogLevel } from '../types/inputs'; import type { LogSink, LoggerConfig } from './types'; type LazyMessage = () => string; type LazyParams = () => Record<string, any>; export declare class Log { static logLevel: LogLevel | null; private static sinks; private static defaultMeta?; private static formatMessage; /** Configure JS logger: replace sinks and/or set default metadata */ static configure(config: LoggerConfig): void; /** Register additional sink */ static addSink(sink: LogSink): void; /** Remove sink by id and call its destroy if present */ static removeSink(id: string): void; /** Clear all sinks and destroy them */ static clearSinks(): void; /** * Gets the appropriate log level integer for a log level. * @internal */ private static getLogLevelInt; /** * Logs a message to the console if the log level is appropriate. * Uses lazy evaluation to avoid unnecessary computations. * @internal */ static log(logLevel: LogLevel, funcName: string, message: LazyMessage, params?: LazyParams): void; static info(funcName: string, message: LazyMessage, params?: LazyParams): void; static warn(funcName: string, message: LazyMessage, params?: LazyParams): void; static error(funcName: string, message: LazyMessage, params?: LazyParams): void; static verbose(funcName: string, message: LazyMessage, params?: LazyParams): void; } export {};