@h4ad/serverless-adapter
Version:
Run REST APIs and other web applications using your existing Node.js application framework (NestJS, Express, Koa, Hapi, Fastify and many others), on top of AWS, Azure, Digital Ocean and many other clouds.
66 lines (64 loc) • 1.72 kB
TypeScript
/**
* The type representing the possible log levels to choose from.
*
* @breadcrumb Core / Logger
* @public
*/
type LogLevels = 'debug' | 'verbose' | 'info' | 'warn' | 'error' | 'none';
/**
* The options to customize {@link ILogger}
*
* @breadcrumb Core / Logger
* @public
*/
type LoggerOptions = {
/**
* Select the log level, {@link LogLevels | see more}.
*
* @defaultValue error
*/
level: LogLevels;
};
/**
* The log function used in any level.
*
* @breadcrumb Core / Logger
* @public
*/
type LoggerFN = (message: any, ...additional: any[]) => void;
/**
* The interface representing the logger, you can provide a custom logger by implementing this interface.
*
* @breadcrumb Core / Logger
* @public
*/
type ILogger = Record<Exclude<LogLevels, 'none'>, LoggerFN>;
/**
* The method used to create a simple logger instance to use in this library.
*
* @remarks Behind the scenes, this simple logger sends the message to the `console` methods.
*
* @example
* ```typescript
* const logger = createDefaultLogger();
*
* logger.error('An error happens.');
* // An error happens.
* ```
*
* @param level - Select the level of the log
*
* @breadcrumb Core / Logger
* @public
*/
declare function createDefaultLogger({ level }?: LoggerOptions): ILogger;
/**
* The method used to chck if logger was created by this library, or it was defined by the user.
*
* @param logger - The instance of the logger to check
*
* @breadcrumb Core / Logger
* @public
*/
declare function isInternalLogger(logger: ILogger): boolean;
export { type ILogger as I, type LogLevels as L, type LoggerOptions as a, type LoggerFN as b, createDefaultLogger as c, isInternalLogger as i };