Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Logger

Hierarchy

  • Logger

Index

Constructors

constructor

Properties

options

stream

stream: WritableStream

Methods

Private colorize

  • colorize(val: any, styles: string | string[]): string | any[]
  • Colorize Applies ansi styles to value.

    Parameters

    • val: any

      the value to be colorized.

    • styles: string | string[]

      the styles to be applied.

    Returns string | any[]

Private colorizeIf

  • colorizeIf(val: any, styles: string | string[]): any
  • Colorize If If colors are enabled apply ansi styles to value.

    Parameters

    • val: any

      the value to be colorized.

    • styles: string | string[]

      the styles to be applied.

    Returns any

debug

  • debug(...args: any[]): Logger

error

  • error(...args: any[]): Logger

exit

  • exit(code?: number): void
  • Parameters

    • Optional code: number

    Returns void

get

  • get<T>(key: string): T
  • Get Gets a current option value.

    Type parameters

    • T

    Parameters

    • key: string

      the option key to get.

    Returns T

Private getIndex

  • getIndex(key: any, arr: any[]): number
  • Get Index Gets the index of a value in an array.

    Parameters

    • key: any

      the key to get the index for.

    • arr: any[]

      the array to be inspected.

    Returns number

Private getTimestamp

  • getTimestamp(format?: boolean | "time" | "date"): string
  • Get Timestamp Gets a timestamp by format.

    Parameters

    • Optional format: boolean | "time" | "date"

      the format to return.

    Returns string

info

  • info(...args: any[]): Logger

Private logger

  • logger(type: string, ...args: any[]): this
  • Logger Private common logger method.

    Parameters

    • type: string

      the type of log message to log.

    • Rest ...args: any[]

      the arguments to be logged.

    Returns this

Private parseStack

  • Parse Stack Simple stack parser to limit and stylize stacktraces.

    Parameters

    • stack: any

      the stacktrace to be parsed.

    • Optional prune: number

      number of stack frames to prune.

    • Optional depth: number

      the depth to trace.

    Returns IStacktraceResult

set

  • Set Sets options for Logger.

    Parameters

    • key: string | ILoggerOptions

      the key or options object to be set.

    • value: any

      the value for the key.

    Returns void

Private toggleExceptionHandler

  • toggleExceptionHandler(capture?: boolean): void
  • Toggle Exception Handler Toggles uncaughtException listener.

    Parameters

    • Optional capture: boolean

      whether to capture uncaught exceptions or not.

    Returns void

Private uncaughtException

  • uncaughtException(err: Error): void
  • Uncaught Exception Handler for uncaught excrptions.

    Parameters

    • err: Error

      the error caught by process uncaughtException.

    Returns void

warn

  • warn(...args: any[]): Logger

write

  • write(...args: any[]): Logger

Generated using TypeDoc