/** * 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 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 implementationSync(level: string, message: string): any; /** * System is unusable. * * @param message The message to log * @param context The context data to use with the message */ emergencySync(message: string, context?: object): any; /** * 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 */ alertSync(message: string, context?: object): any; /** * Critical conditions. * * Example: Application component unavailable, unexpected exception. * * @param message The message to log * @param context The context data to use with the message */ criticalSync(message: string, context?: object): any; /** * 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 */ errorSync(message: string, context?: object): any; /** * 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 */ warningSync(message: string, context?: object): any; /** * Normal but significant events. * * @param message The message to log * @param context The context data to use with the message */ noticeSync(message: string, context?: object): any; /** * Interesting events. * * Example: User logs in, SQL logs. * * @param message The message to log * @param context The context data to use with the message */ infoSync(message: string, context?: object): any; /** * Detailed debug information. * * @param message The message to log * @param context The context data to use with the message */ debugSync(message: string, context?: object): any; /** * 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 */ logSync(level: string, message: string, context?: object): any; }