Comunica
    Preparing search index...

    A logger that pretty-prints everything.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    activeLogGroups: Record<
        string,
        { callback: (count: number) => void; count: number; lastSeenIndex: number },
    > = {}
    groupedLogLimit: 5
    repetitionCounter: number = 0
    COLOR_BLUE: string = '\u001B[34m'
    COLOR_CYAN: string = '\u001B[36m'
    COLOR_GRAY: string = '\u001B[90m'
    COLOR_GREEN: string = '\u001B[32m'
    COLOR_MAGENTA: string = '\u001B[35m'
    COLOR_RED: string = '\u001B[31m'
    COLOR_RESET: string = '\u001B[0m'
    COLOR_YELLOW: string = '\u001B[33m'
    LEVELS: Record<string, number> = ...

    All available logging levels.

    Methods

    • Check if messages at the given level are emitted, so callers can skip computing their log data otherwise.

      Parameters

      • level: string

        The logging level to check.

      Returns boolean

      If messages at the given level are emitted, which is always the case by default.

    • Parameters

      • level: string
      • color: string
      • message: string
      • Optionaldata: any

      Returns void

    • Log a message that might be repeated, preventing console spam. If the same key is passed multiple times, only the first time the emit callback will be invoked immediately. All subsequent calls will be buffered, until at least Logger#groupedLogLimit other logGrouped calls are made, or Logger#flush is called.

      Parameters

      • key: string

        A unique key for this message (e.g. the message template).

      • emit: (count: number) => void

        A callback to emit the message.

      Returns void

    • Convert a string-based logging level to a numerical logging level.

      Parameters

      • level: string

        A string-based logging level

      Returns number

      The numerical logging level, or undefined.

    • Return a string in a given color

      Parameters

      • str: any

        The string that should be printed in

      • color: string

        A given color

      Returns string