Logger class for logging messages with ANSI styling and formatting.

Constructors

Methods

  • Colors the given text with the specified ANSI styles.

    Parameters

    • text: string

      The text to color.

    • Rest ...styles: string[]

      The styles to apply.

    Returns string

    The styled text.

  • Creates an ANSI escape code string with the specified styles.

    Parameters

    • Rest ...styles: string[]

      The styles to apply.

    Returns string

    The ANSI escape code string.

  • Logs a debug message.

    Parameters

    • from: string

      The source of the message.

    • message: string

      The message to log.

    Returns void

  • Logs an error message.

    Parameters

    • from: string

      The source of the message.

    • error: string

      The error message to log.

    Returns void

  • Formats the given text by adding a tab character before each line.

    Parameters

    • text: string

      The text to format.

    Returns string

    The formatted text.

  • Logs an informational message.

    Parameters

    • from: string

      The source of the message.

    • message: string

      The message to log.

    Returns void

  • Pads the given text to the specified length using the specified characters.

    Parameters

    • text: string

      The text to pad.

    • length: number

      The desired length of the padded text.

    • chars: string = " "

      The characters to use for padding. Defaults to a space.

    Returns string

    The padded text.

  • Logs a warning message.

    Parameters

    • from: string

      The source of the message.

    • message: string

      The message to log.

    Returns void