Options
All
  • Public
  • Public/Protected
  • All
Menu

Class LogStream

Hierarchy

  • Writable
    • LogStream

Implements

  • WritableStream

Index

Constructors

constructor

  • new LogStream(level?: string, opts?: WritableOptions): LogStream
  • Parameters

    • Default value level: string = "info"
    • Optional opts: WritableOptions

    Returns LogStream

Properties

Private buffer

buffer: string

level

level: string

writable

writable: boolean

Static defaultMaxListeners

defaultMaxListeners: number

Methods

_write

  • _write(chunk: any, encoding: string, callback: Function): void
  • Parameters

    • chunk: any
    • encoding: string
    • callback: Function

    Returns void

addListener

  • addListener(event: string, listener: Function): this
  • addListener(event: "close", listener: function): this
  • addListener(event: "drain", listener: function): this
  • addListener(event: "error", listener: function): this
  • addListener(event: "finish", listener: function): this
  • addListener(event: "pipe", listener: function): this
  • addListener(event: "unpipe", listener: function): this
  • Event emitter The defined events on documents including:

    1. close
    2. drain
    3. error
    4. finish
    5. pipe
    6. unpipe

    Parameters

    • event: string
    • listener: Function

    Returns this

  • Parameters

    • event: "close"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "drain"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "error"
    • listener: function
        • (err: Error): void
        • Parameters

          • err: Error

          Returns void

    Returns this

  • Parameters

    • event: "finish"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "pipe"
    • listener: function
        • (src: Readable): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

  • Parameters

    • event: "unpipe"
    • listener: function
        • (src: Readable): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • emit(event: "close"): boolean
  • emit(event: "drain", chunk: Buffer | string): boolean
  • emit(event: "error", err: Error): boolean
  • emit(event: "finish"): boolean
  • emit(event: "pipe", src: Readable): boolean
  • emit(event: "unpipe", src: Readable): boolean
  • Parameters

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

    Returns boolean

  • Parameters

    • event: "close"

    Returns boolean

  • Parameters

    • event: "drain"
    • chunk: Buffer | string

    Returns boolean

  • Parameters

    • event: "error"
    • err: Error

    Returns boolean

  • Parameters

    • event: "finish"

    Returns boolean

  • Parameters

    • event: "pipe"
    • src: Readable

    Returns boolean

  • Parameters

    • event: "unpipe"
    • src: Readable

    Returns boolean

end

  • end(): void
  • end(chunk: any, cb?: Function): void
  • end(chunk: any, encoding?: undefined | string, cb?: Function): void
  • Returns void

  • Parameters

    • chunk: any
    • Optional cb: Function

    Returns void

  • Parameters

    • chunk: any
    • Optional encoding: undefined | string
    • Optional cb: Function

    Returns void

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (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[]

on

  • on(event: string, listener: Function): this
  • on(event: "close", listener: function): this
  • on(event: "drain", listener: function): this
  • on(event: "error", listener: function): this
  • on(event: "finish", listener: function): this
  • on(event: "pipe", listener: function): this
  • on(event: "unpipe", listener: function): this
  • Parameters

    • event: string
    • listener: Function

    Returns this

  • Parameters

    • event: "close"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "drain"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "error"
    • listener: function
        • (err: Error): void
        • Parameters

          • err: Error

          Returns void

    Returns this

  • Parameters

    • event: "finish"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "pipe"
    • listener: function
        • (src: Readable): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

  • Parameters

    • event: "unpipe"
    • listener: function
        • (src: Readable): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

once

  • once(event: string, listener: Function): this
  • once(event: "close", listener: function): this
  • once(event: "drain", listener: function): this
  • once(event: "error", listener: function): this
  • once(event: "finish", listener: function): this
  • once(event: "pipe", listener: function): this
  • once(event: "unpipe", listener: function): this
  • Parameters

    • event: string
    • listener: Function

    Returns this

  • Parameters

    • event: "close"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "drain"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "error"
    • listener: function
        • (err: Error): void
        • Parameters

          • err: Error

          Returns void

    Returns this

  • Parameters

    • event: "finish"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "pipe"
    • listener: function
        • (src: Readable): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

  • Parameters

    • event: "unpipe"
    • listener: function
        • (src: Readable): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

pipe

  • pipe<T>(destination: T, options?: undefined | object): T
  • Type parameters

    • T: WritableStream

    Parameters

    • destination: T
    • Optional options: undefined | object

    Returns T

prependListener

  • prependListener(event: string, listener: Function): this
  • prependListener(event: "close", listener: function): this
  • prependListener(event: "drain", listener: function): this
  • prependListener(event: "error", listener: function): this
  • prependListener(event: "finish", listener: function): this
  • prependListener(event: "pipe", listener: function): this
  • prependListener(event: "unpipe", listener: function): this
  • Parameters

    • event: string
    • listener: Function

    Returns this

  • Parameters

    • event: "close"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "drain"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "error"
    • listener: function
        • (err: Error): void
        • Parameters

          • err: Error

          Returns void

    Returns this

  • Parameters

    • event: "finish"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "pipe"
    • listener: function
        • (src: Readable): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

  • Parameters

    • event: "unpipe"
    • listener: function
        • (src: Readable): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string, listener: Function): this
  • prependOnceListener(event: "close", listener: function): this
  • prependOnceListener(event: "drain", listener: function): this
  • prependOnceListener(event: "error", listener: function): this
  • prependOnceListener(event: "finish", listener: function): this
  • prependOnceListener(event: "pipe", listener: function): this
  • prependOnceListener(event: "unpipe", listener: function): this
  • Parameters

    • event: string
    • listener: Function

    Returns this

  • Parameters

    • event: "close"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "drain"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "error"
    • listener: function
        • (err: Error): void
        • Parameters

          • err: Error

          Returns void

    Returns this

  • Parameters

    • event: "finish"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "pipe"
    • listener: function
        • (src: Readable): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

  • Parameters

    • event: "unpipe"
    • listener: function
        • (src: Readable): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

removeAllListeners

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

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string, listener: Function): this
  • removeListener(event: "close", listener: function): this
  • removeListener(event: "drain", listener: function): this
  • removeListener(event: "error", listener: function): this
  • removeListener(event: "finish", listener: function): this
  • removeListener(event: "pipe", listener: function): this
  • removeListener(event: "unpipe", listener: function): this
  • Parameters

    • event: string
    • listener: Function

    Returns this

  • Parameters

    • event: "close"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "drain"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "error"
    • listener: function
        • (err: Error): void
        • Parameters

          • err: Error

          Returns void

    Returns this

  • Parameters

    • event: "finish"
    • listener: function
        • (): void
        • Returns void

    Returns this

  • Parameters

    • event: "pipe"
    • listener: function
        • (src: Readable): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

  • Parameters

    • event: "unpipe"
    • listener: function
        • (src: Readable): void
        • Parameters

          • src: Readable

          Returns void

    Returns this

setDefaultEncoding

  • setDefaultEncoding(encoding: string): this
  • Parameters

    • encoding: string

    Returns this

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

write

  • write(chunk: any, cb?: Function): boolean
  • write(chunk: any, encoding?: undefined | string, cb?: Function): boolean
  • Parameters

    • chunk: any
    • Optional cb: Function

    Returns boolean

  • Parameters

    • chunk: any
    • Optional encoding: undefined | string
    • Optional cb: Function

    Returns boolean

Private writeLog

  • writeLog(str: string): void

Private writeLogMultiline

  • writeLogMultiline(chunk: string): void

Static listenerCount

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

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Generated using TypeDoc