Hierarchy

  • Logger

Constructors

  • Creates a new Logger with a pre-defined log batch, hostname and port.

    Parameters

    • logs: Log[]

      The log batch to be sent with this Logger.

    • host: string

      The hostname/IP/domain of the remote CodeCTRL server for this batch to be sent to.

    • port: string

      The port that the remote CodeCTRL server is listening on.

    Returns Logger

Properties

batchHost: string
batchPort: string
logBatch: Log[]

Methods

  • Sends the current logBatch created created by the LogBatch helper class or the constructor of this class.

    Returns Promise<LoggerResult<undefined>>

  • Type Parameters

    Parameters

    • message: T
    • _surround: number

    Returns Log

  • Parameters

    • filePath: string
    • lineNumber: number

    Returns string

  • Parameters

    • filePath: string
    • lineNumber: number
    • surround: number

    Returns {
        [key: number]: string;
    }

    • [key: number]: string
  • The basic log function.

    Type Parameters

    Parameters

    • message: T

      The message to be sent to the logger. Accepts any T that implements a toString function.

    • Optional surround: number

      The amount of surrounding code to include in the code snippet.

    • Optional host: string

      The host of the CodeCTRL instance.

    • Optional port: string

      The port of the CodeCTRL instance.

    Returns Promise<LoggerResult<RequestResult>>

  • A log function that takes an anonymous function, and only logs if the function returns a true condition.

    Type Parameters

    Parameters

    • condition: (() => boolean)

      The anonymous function that determines whether a log is sent.

        • (): boolean
        • Returns boolean

    • message: T

      The message to be sent to the logger. Accepts any T that implements a toString function.

    • Optional surround: number

      The amount of surrounding code to include in the code snippet.

    • Optional host: string

      The host of the CodeCTRL instance.

    • Optional port: string

      The port of the CodeCTRL instance.

    Returns Promise<LoggerResult<false | RequestResult>>

  • A log function similar to Logger.logIf that only takes effect if the environment variable CODECTRL_DEBUG is present or not.

    Type Parameters

    Parameters

    • message: T

      The message to be sent to the logger. Accepts any T that implements a toString function.

    • Optional surround: number

      The amount of surrounding code to include in the code snippet.

    • Optional host: string

      The host of the CodeCTRL instance.

    • Optional port: string

      The port of the CodeCTRL instance.

    Returns Promise<LoggerResult<false | RequestResult>>

Generated using TypeDoc