Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Logger

The Logger class manages Orbiter's client-side log, which records client/server communications and events of general interest for the purposes of debugging. To access Orbiter's Logger instance, use the Orbiter.getLog method.

To read the log's history of log entries, use the getHistory() method. To be notified whenever a new message is added to the log, use addEventListener() to register for the LogEvent.UPDATE event.

To add new messages to the log, use the fatal(), error(), warn(), info(), or debug() methods. An application's most important log messages should be added via fatal(); least important messages should be added via debug().

Hierarchy

  • EventDispatcher
    • Logger

Index

Constructors

constructor

  • new Logger(historyLength?: number): Logger
  • Parameters

    • Default value historyLength: number = 100

    Returns Logger

Properties

Readonly target

target: EventDispatcher

Static Readonly DEBUG

DEBUG: "DEBUG" = "DEBUG"

Static Readonly ERROR

ERROR: "ERROR" = "ERROR"

Static Readonly FATAL

FATAL: "FATAL" = "FATAL"

Static Readonly INFO

INFO: "INFO" = "INFO"

Static Readonly WARN

WARN: "WARN" = "WARN"

Static Readonly logLevels

logLevels: string[] = [Logger.FATAL, Logger.ERROR, Logger.WARN, Logger.INFO, Logger.DEBUG]

Methods

addEventListener

  • addEventListener(type: string, listener: Function, thisArg: any, priority?: number): boolean
  • Parameters

    • type: string
    • listener: Function
    • thisArg: any
    • Default value priority: number = 0

    Returns boolean

addSuppressionTerm

  • addSuppressionTerm(term: string): void
  • Forces the log to ignore entries containing the specified term.

    Parameters

    • term: string

      The term to match.

    Returns void

debug

  • debug(msg: string): void
  • Sends a message to the log, with severity "DEBUG".

    Parameters

    • msg: string

    Returns void

disableTimeStamp

  • disableTimeStamp(): void
  • Hides the time stamp on subsequent messages.

    Returns void

dispatchEvent

  • dispatchEvent(event: Event): void
  • Parameters

    • event: Event

    Returns void

enableTimeStamp

  • enableTimeStamp(): void
  • Adds a time stamp to all subsequent messages.

    Returns void

error

  • error(msg: string): void
  • Sends a message to the log, with severity "ERROR".

    Parameters

    • msg: string

    Returns void

fatal

  • fatal(msg: string): void
  • Sends a message to the log, with severity "FATAL".

    Parameters

    • msg: string

    Returns void

getHistory

  • getHistory(): string[]
  • Returns all messages in the log's history.

    Returns string[]

getHistoryLength

  • getHistoryLength(): number
  • Returns the number of messages that are kept in the log's history. Defaults to 100.

    Returns number

getLevel

  • getLevel(): string
  • Returns the human-readable message filter level for the log.

    Returns string

getListeners

  • getListeners(type: string): EventListener[]
  • Parameters

    • type: string

    Returns EventListener[]

hasListener

  • hasListener(type: string, listener: Function, thisArg: any): boolean
  • Parameters

    • type: string
    • listener: Function
    • thisArg: any

    Returns boolean

info

  • info(msg: string): void
  • Sends a message to the log, with severity "INFO".

    Parameters

    • msg: string

    Returns void

removeEventListener

  • removeEventListener(type: string, listener: Function, thisArg: any): boolean
  • Parameters

    • type: string
    • listener: Function
    • thisArg: any

    Returns boolean

removeSuppressionTerm

  • removeSuppressionTerm(term: string): boolean
  • Instructs the log to stop ignoring entries containing the specified term.

    Parameters

    • term: string

      The term to match.

    Returns boolean

    true if the term was removed; false if the term was not found.

setHistoryLength

  • setHistoryLength(newHistoryLength: number): void
  • Specifies the number of messages that should be kept in the log's history.

    Parameters

    • newHistoryLength: number

    Returns void

setLevel

  • setLevel(level: string): void
  • Sets the message filter level for the log. The supplied level must be one of the following Logger constants: Logger.FATAL, Logger.ERROR, Logger.WARN, Logger.INFO, or Logger.DEBUG. Log levels are ranked in order, with FATAL being most severe and DEBUG being least severe. Messages that are less severe than the filter level set via setLevel() are excluded from the log. For example, if the filter level is set to Logger.DEBUG, all messages are included in the log. If the filter level is set to Logger.WARN, messages sent via Logger's debug() and info() methods are excluded from the log, but messages sent via Logger's error(), warn(), and fatal() methods are included in the log. The default log level is Logger.INFO (exclude DEBUG messages only).

    Parameters

    • level: string

    Returns void

toString

  • toString(): string
  • Returns string

warn

  • warn(msg: string): void
  • Sends a message to the log, with severity "WARN".

    Parameters

    • msg: string

    Returns void