UNPKG

1.66 kBTypeScriptView Raw
1import type { LogData } from './LogBox';
2type LogFunction = (data: LogData) => void;
3export declare enum LogLevel {
4 warn = 1,
5 error = 2
6}
7export type LoggerConfig = {
8 level?: LogLevel;
9 strict?: boolean;
10};
11export type LoggerConfigInternal = {
12 logFunction: LogFunction;
13} & Required<LoggerConfig>;
14export declare const DEFAULT_LOGGER_CONFIG: LoggerConfigInternal;
15/**
16 * Function that logs to LogBox and console. Used to replace the default console
17 * logging with logging to LogBox on the UI thread when runOnJS is available.
18 *
19 * @param data - The details of the log.
20 */
21export declare function logToLogBoxAndConsole(data: LogData): void;
22/**
23 * Registers the logger configuration. use it only for Worklet runtimes.
24 *
25 * @param config - The config to register.
26 */
27export declare function registerLoggerConfig(config: LoggerConfigInternal): void;
28/**
29 * Replaces the default log function with a custom implementation.
30 *
31 * @param logFunction - The custom log function.
32 */
33export declare function replaceLoggerImplementation(logFunction: LogFunction): void;
34/**
35 * Updates logger configuration.
36 *
37 * @param options - The new logger configuration to apply.
38 *
39 * - Level: The minimum log level to display.
40 * - Strict: Whether to log warnings and errors that are not strict. Defaults to
41 * false.
42 */
43export declare function updateLoggerConfig(options?: Partial<LoggerConfig>): void;
44type LogOptions = {
45 strict?: boolean;
46};
47export declare const logger: {
48 warn(message: string, options?: LogOptions): void;
49 error(message: string, options?: LogOptions): void;
50};
51export {};
52//# sourceMappingURL=logger.d.ts.map
\No newline at end of file