UNPKG

@react-native-firebase/app

Version:

A well tested, feature rich Firebase implementation for React Native, supporting iOS & Android. Individual module support for Admob, Analytics, Auth, Crash Reporting, Cloud Firestore, Database, Dynamic Links, Functions, Messaging (FCM), Remote Config, Sto

83 lines 2.73 kB
import type { LogCallback, LogOptions } from '../types/app'; type LogLevelString = 'debug' | 'verbose' | 'info' | 'warn' | 'error' | 'silent'; /** * The JS SDK supports 5 log levels and also allows a user the ability to * silence the logs altogether. * * The order is a follows: * DEBUG < VERBOSE < INFO < WARN < ERROR * * All of the log types above the current log level will be captured (i.e. if * you set the log level to `INFO`, errors will still be logged, but `DEBUG` and * `VERBOSE` logs will not) */ export declare enum LogLevel { DEBUG = 0, VERBOSE = 1, INFO = 2, WARN = 3, ERROR = 4, SILENT = 5 } /** * We allow users the ability to pass their own log handler. We will pass the * type of log, the current log level, and any other arguments passed (i.e. the * messages that the user wants to log) to this function. */ export type LogHandler = (loggerInstance: Logger, logType: LogLevel, ...args: unknown[]) => void; /** * A container for all of the Logger instances */ export declare const instances: Logger[]; /** * Logger class for Firebase */ export declare class Logger { name: string; private _logLevel; private _logHandler; private _userLogHandler; /** * Gives you an instance of a Logger to capture messages according to * Firebase's logging scheme. * * @param name The name that the logs will be associated with */ constructor(name: string); /** * The log level of the given Logger instance. */ get logLevel(): LogLevel; set logLevel(val: LogLevel); setLogLevel(val: LogLevel | LogLevelString): void; /** * The main (internal) log handler for the Logger instance. * Can be set to a new function in internal package code but not by user. */ get logHandler(): LogHandler; set logHandler(val: LogHandler); /** * The optional, additional, user-defined log handler for the Logger instance. */ get userLogHandler(): LogHandler | null; set userLogHandler(val: LogHandler | null); /** * The functions below are all based on the `console` interface */ debug(...args: unknown[]): void; log(...args: unknown[]): void; info(...args: unknown[]): void; warn(...args: unknown[]): void; error(...args: unknown[]): void; } /** * Sets the log level for all Logger instances */ export declare function setLogLevel(level: LogLevelString | LogLevel): void; export declare const setLogLevelInternal: typeof setLogLevel; /** * Sets a custom user log handler for all Logger instances */ export declare function setUserLogHandler(logCallback: LogCallback | null, options?: LogOptions): void; export {}; //# sourceMappingURL=logger.d.ts.map