Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Logger

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!!

Hierarchy

Index

Methods

alert

  • alert(message: string, context?: object): Promise<any>
  • Action must be taken immediately.

    Example: Entire website down, database unavailable, etc. This should trigger the SMS alerts and wake you up.

    Parameters

    • message: string

      The message to log

    • Optional context: object

      The context data to use with the message

    Returns Promise<any>

alertSync

  • alertSync(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.

    Parameters

    • message: string

      The message to log

    • Optional context: object

      The context data to use with the message

    Returns any

critical

  • critical(message: string, context?: object): Promise<any>
  • Critical conditions.

    Example: Application component unavailable, unexpected exception.

    Parameters

    • message: string

      The message to log

    • Optional context: object

      The context data to use with the message

    Returns Promise<any>

criticalSync

  • criticalSync(message: string, context?: object): any
  • Critical conditions.

    Example: Application component unavailable, unexpected exception.

    Parameters

    • message: string

      The message to log

    • Optional context: object

      The context data to use with the message

    Returns any

debug

  • debug(message: string, context?: object): Promise<any>
  • Detailed debug information.

    Parameters

    • message: string

      The message to log

    • Optional context: object

      The context data to use with the message

    Returns Promise<any>

debugSync

  • debugSync(message: string, context?: object): any
  • Detailed debug information.

    Parameters

    • message: string

      The message to log

    • Optional context: object

      The context data to use with the message

    Returns any

emergency

  • emergency(message: string, context?: object): Promise<any>
  • System is unusable.

    Parameters

    • message: string

      The message to log

    • Optional context: object

      The context data to use with the message

    Returns Promise<any>

emergencySync

  • emergencySync(message: string, context?: object): any
  • System is unusable.

    Parameters

    • message: string

      The message to log

    • Optional context: object

      The context data to use with the message

    Returns any

error

  • error(message: string, context?: object): Promise<any>
  • Runtime errors that do not require immediate action but should typically be logged and monitored.

    Parameters

    • message: string

      The message to log

    • Optional context: object

      The context data to use with the message

    Returns Promise<any>

errorSync

  • errorSync(message: string, context?: object): any
  • Runtime errors that do not require immediate action but should typically be logged and monitored.

    Parameters

    • message: string

      The message to log

    • Optional context: object

      The context data to use with the message

    Returns any

Protected implementation

  • implementation(level: string, message: string): Promise<any>
  • Create the implementation of this specific logger

    Parameters

    • level: string

      The level of the log entry

    • message: string

      The message to log

    Returns Promise<any>

Protected implementationSync

  • implementationSync(level: string, message: string): any

info

  • info(message: string, context?: object): Promise<any>
  • Interesting events.

    Example: User logs in, SQL logs.

    Parameters

    • message: string

      The message to log

    • Optional context: object

      The context data to use with the message

    Returns Promise<any>

infoSync

  • infoSync(message: string, context?: object): any
  • Interesting events.

    Example: User logs in, SQL logs.

    Parameters

    • message: string

      The message to log

    • Optional context: object

      The context data to use with the message

    Returns any

Protected interpolate

  • interpolate(message: string, context?: object): string
  • 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.

    Parameters

    • message: string

      The message to use in the interpolation

    • Optional context: object

      The context data to use with the message

    Returns string

log

  • log(level: string, message: string, context?: object): Promise<any>
  • Logs with an arbitrary level.

    Parameters

    • level: string

      The level of the log entry

    • message: string

      The message to log

    • Optional context: object

      The context data to use with the message

    Returns Promise<any>

logSync

  • logSync(level: string, message: string, context?: object): any
  • Logs with an arbitrary level.

    Parameters

    • level: string

      The level of the log entry

    • message: string

      The message to log

    • Optional context: object

      The context data to use with the message

    Returns any

notice

  • notice(message: string, context?: object): Promise<any>
  • Normal but significant events.

    Parameters

    • message: string

      The message to log

    • Optional context: object

      The context data to use with the message

    Returns Promise<any>

noticeSync

  • noticeSync(message: string, context?: object): any
  • Normal but significant events.

    Parameters

    • message: string

      The message to log

    • Optional context: object

      The context data to use with the message

    Returns any

warning

  • warning(message: string, context?: object): Promise<any>
  • Exceptional occurrences that are not errors.

    Example: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.

    Parameters

    • message: string

      The message to log

    • Optional context: object

      The context data to use with the message

    Returns Promise<any>

warningSync

  • warningSync(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.

    Parameters

    • message: string

      The message to log

    • Optional context: object

      The context data to use with the message

    Returns any

Generated using TypeDoc