Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ButtplugLogger

Simple, global logging utility for the Buttplug client and server. Keeps an internal static reference to an instance of itself (singleton pattern, basically), and allows message logging throughout the module.

Hierarchy

  • EventEmitter
    • ButtplugLogger

Index

Constructors

Protected constructor

  • Constructor. Can only be called internally since we regulate ButtplugLogger ownership.

    Returns ButtplugLogger

Properties

Protected maximumConsoleLogLevel

maximumConsoleLogLevel: ButtplugLogLevel = ButtplugLogLevel.Off

Sets maximum log level to log to console

Protected maximumEventLogLevel

maximumEventLogLevel: ButtplugLogLevel = ButtplugLogLevel.Off

Sets maximum log level for all log messages

Static defaultMaxListeners

defaultMaxListeners: number

Static Protected sLogger

sLogger: ButtplugLogger | undefined = undefined

Singleton instance for the logger

Accessors

MaximumConsoleLogLevel

  • Set the maximum log level to output to console.

    Returns ButtplugLogLevel

  • Get the maximum log level to output to console.

    Parameters

    Returns void

MaximumEventLogLevel

  • Set the global maximum log level

    Returns ButtplugLogLevel

  • Get the global maximum log level

    Parameters

    Returns void

Static Logger

  • Returns the stored static instance of the logger, creating one if it doesn't currently exist.

    Returns ButtplugLogger

Methods

Protected AddLogMessage

  • Checks to see if message should be logged, and if so, adds message to the log buffer. May also print message and emit event.

    Parameters

    Returns void

Debug

  • Debug(aMsg: string): void
  • Log new message at Debug level.

    Parameters

    • aMsg: string

    Returns void

Error

  • Error(aMsg: string): void
  • Log new message at Error level.

    Parameters

    • aMsg: string

    Returns void

Fatal

  • Fatal(aMsg: string): void
  • Log new message at Fatal level.

    Parameters

    • aMsg: string

    Returns void

Info

  • Info(aMsg: string): void
  • Log new message at Info level.

    Parameters

    • aMsg: string

    Returns void

LogAndError

  • Log a message, then create a Error buttplug message with the log message. Used when an operation has errored out and status needs to be both logged and returned to the client as an Error Message type.

    Parameters

    • aMsg: string
    • aErrorClass: ErrorClass
    • aMsgId: number

    Returns ButtplugMessage

Trace

  • Trace(aMsg: string): void
  • Log new message at Trace level.

    Parameters

    • aMsg: string

    Returns void

Warn

  • Warn(aMsg: string): void
  • Log new message at Warn level.

    Parameters

    • aMsg: string

    Returns void

addListener

  • addListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

eventNames

  • eventNames(): Array<string | symbol>
  • Returns Array<string | symbol>

getMaxListeners

  • getMaxListeners(): number
  • Returns number

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

off

  • off(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

once

  • once(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependListener

  • prependListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string | symbol, listener: function): this
  • Parameters

    • event: string | symbol
    • listener: function
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Generated using TypeDoc