Options
All
  • Public
  • Public/Protected
  • All
Menu

Class StdOutLog

Log that writes to a Writable. By default process.stdout and process.stderr are used.

When formatting the message by default util.format is used but you can set LogConfig.messageFormat to use something like printj.sprintf as well.

Hierarchy

  • Log
    • StdOutLog

Implements

  • LogWriter
  • Enabled

Index

Constructors

Protected constructor

  • new StdOutLog(name: string, config: LogConfig, parent?: Log, env?: Env, stdout?: Writable, stderr?: Writable): StdOutLog

Properties

Readonly _enabled

_enabled: PropEnabled

Readonly config

config: LogConfig

Configuration.

Readonly env

env: Env

Environment configuration for this Log instance.

Readonly envProps

envProps: Props

Readonly fqn

fqn: string

This log's fully qualified name.

Readonly name

name: string

A name for this logger. Will be appended onto parent.fqn if parent exists.

Optional Readonly parent

parent: Log | undefined

A parent Log instance.

Protected Readonly stderr

stderr: Writable

Protected Readonly stdout

stdout: Writable

Methods

Protected _write

  • _write(level: LogLevel, message: MessageContext, ...args: unknown[]): void | Error

alert

  • Parameters

    Returns void | Error

child

  • child(options?: Record<string, any>): Log
  • Parameters

    • Optional options: Record<string, any>

    Returns Log

copy

Protected createOutputString

  • createOutputString(level: LogLevel, msg: MessageContext, ...args: unknown[]): string

critical

debug

  • debug(message: LogMessage, ...args: unknown[]): void
  • Parameters

    Returns void

emergency

enabled

  • enabled(key?: Key): boolean
  • Parameters

    • Optional key: Key

    Returns boolean

error

  • error(message: LogMessage, ...args: unknown[]): void
  • Parameters

    Returns void

extend

info

  • info(message: LogMessage, ...args: unknown[]): void
  • Parameters

    Returns void

level

  • level(): LogLevel
  • Get this Log instance's Level.

    Returns LogLevel

log

  • log(message: LogMessage, ...args: unknown[]): void
  • Parameters

    Returns void

logLevelEnabled

  • logLevelEnabled(level: LogLevel | string): boolean
  • Check if level should be logged in this Log instance.

    Parameters

    • level: LogLevel | string

    Returns boolean

prop

  • prop(name: string): string | undefined
  • Parameters

    • name: string

    Returns string | undefined

Protected runInterceptors

  • runInterceptors(level: any, context: any): void
  • Parameters

    • level: any
    • context: any

    Returns void

table

  • table(tabularData: any, properties: string[]): void
  • This will create a Console that prints the table to this.stdout.

    Parameters

    • tabularData: any
    • properties: string[]

    Returns void

trace

  • trace(message: LogMessage, ...args: unknown[]): void
  • Parameters

    Returns void

warn

  • warn(message: LogMessage, ...args: unknown[]): void
  • Parameters

    Returns void

write

  • write(level: LogLevel, message: LogMessage, ...args: unknown[]): void | Error
  • Parameters

    • level: LogLevel
    • message: LogMessage
    • Rest ...args: unknown[]

    Returns void | Error

Static create

Generated using TypeDoc