@devgalena/react-use-logger
Version:
`react-use-logger` is a React hook to log messages. It also contains a function `useLogger` and a class `LoggingContextProvider` to set the logging levels of the library / application
29 lines (28 loc) • 885 B
TypeScript
import { LoggingLevel, RenderLoggerFnType } from './types';
/**
* Type of `LoggingContext`
*/
export interface LoggingContextType {
/**
* LoggingLevel set for the logger
*/
level?: LoggingLevel;
/**
* Function to render the log information
*/
render?: RenderLoggerFnType;
}
/**
* React Context to set the parameters for Logging
*/
export declare const LoggingContext: import('react').Context<LoggingContextType | null>;
/**
* React Hook to retrieve the logging context from `LoggingContext`.
*
* Important: This is for internal use only.
* For a practical use of the library use, @see `useLogger`
* @example
* const loggingContext = useLogging(); // level is of type LoggingLevel?
* @returns {LoggingLevel?} The current LoggingLevel as set by `LoggingContextProvider`
*/
export declare const useLogging: () => LoggingContextType | null;