import LoggerSync from "./logger.sync"; /** * Abstract class definition for the creating * custom loggers where the developer only has * to handle the implementation * * Inspired by PSR-3 created by the PHP-FIG team. * Thanks!! */ export default abstract class Logger extends LoggerSync { /** * Method to handle interpolation to recursively combine * a context with a message. Usually this is done directly * with javascript. However, there maybe times when a piece of * code would smell better using this version of interpolation. * * @param message The message to use in the interpolation * @param context The context data to use with the message */ protected interpolate(message: string, context?: object): string; /** * Create the implementation of this specific logger * * @param level The level of the log entry * @param message The message to log * @param context The context data to use with the message */ protected implementation(level: string, message: string): Promise; /** * System is unusable. * * @param message The message to log * @param context The context data to use with the message */ emergency(message: string, context?: object): Promise; /** * Action must be taken immediately. * * Example: Entire website down, database unavailable, etc. This should * trigger the SMS alerts and wake you up. * * @param message The message to log * @param context The context data to use with the message */ alert(message: string, context?: object): Promise; /** * Critical conditions. * * Example: Application component unavailable, unexpected exception. * * @param message The message to log * @param context The context data to use with the message */ critical(message: string, context?: object): Promise; /** * Runtime errors that do not require immediate action but should typically * be logged and monitored. * * @param message The message to log * @param context The context data to use with the message */ error(message: string, context?: object): Promise; /** * Exceptional occurrences that are not errors. * * Example: Use of deprecated APIs, poor use of an API, undesirable things * that are not necessarily wrong. * * @param message The message to log * @param context The context data to use with the message */ warning(message: string, context?: object): Promise; /** * Normal but significant events. * * @param message The message to log * @param context The context data to use with the message */ notice(message: string, context?: object): Promise; /** * Interesting events. * * Example: User logs in, SQL logs. * * @param message The message to log * @param context The context data to use with the message */ info(message: string, context?: object): Promise; /** * Detailed debug information. * * @param message The message to log * @param context The context data to use with the message */ debug(message: string, context?: object): Promise; /** * Logs with an arbitrary level. * * @param level The level of the log entry * @param message The message to log * @param context The context data to use with the message */ log(level: string, message: string, context?: object): Promise; }