Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Logger

The Logger interface used for logging. You can get a Logger from LoggerFactory. LoggerFactory itself you create and configure through LFService.

There are two ways of logging things.

The normal way using: trace, debug, info, warn, error, fatal, all of these methods expect at least an error message, optionally an Error.

Sample: logger.debug("Hello world"); logger.error("This is an error", new Error("fail"));

Using closures: tracec, debugc, infoc, warnc, errorc, fatalc (note the c for closure). These methods expect a closure for the message, and optionally one for the Error. The latter can be very useful if you have something expensive to log, and only really want to log it when the logger framework will log it. In addition you can use the closure one to do special things.

Sample: logger.debugc(() => "Hello world"); logger.errorc(() => "Very expensive " + obj.toDoThis(), () => new Error("Oops")); logger.fatalc(() => { // Do something amazingly custom here return "My Error Message"; });

Hierarchy

  • Logger

Implemented by

Index

Methods

debug

  • debug(msg: string, error?: Error | null): void
  • Parameters

    • msg: string
    • Optional error: Error | null

    Returns void

debugc

  • debugc(msg: function, error: function): void
  • Parameters

    • msg: function
        • (): string
        • Returns string

    • error: function
        • (): Error | null
        • Returns Error | null

    Returns void

error

  • error(msg: string, error?: Error | null): void
  • Parameters

    • msg: string
    • Optional error: Error | null

    Returns void

errorc

  • errorc(msg: function, error: function): void
  • Parameters

    • msg: function
        • (): string
        • Returns string

    • error: function
        • (): Error | null
        • Returns Error | null

    Returns void

fatal

  • fatal(msg: string, error?: Error | null): void
  • Parameters

    • msg: string
    • Optional error: Error | null

    Returns void

fatalc

  • fatalc(msg: function, error: function): void
  • Parameters

    • msg: function
        • (): string
        • Returns string

    • error: function
        • (): Error | null
        • Returns Error | null

    Returns void

getLogLevel

info

  • info(msg: string, error?: Error | null): void
  • Parameters

    • msg: string
    • Optional error: Error | null

    Returns void

infoc

  • infoc(msg: function, error: function): void
  • Parameters

    • msg: function
        • (): string
        • Returns string

    • error: function
        • (): Error | null
        • Returns Error | null

    Returns void

isDebugEnabled

  • isDebugEnabled(): boolean

isErrorEnabled

  • isErrorEnabled(): boolean

isFatalEnabled

  • isFatalEnabled(): boolean

isInfoEnabled

  • isInfoEnabled(): boolean

isTraceEnabled

  • isTraceEnabled(): boolean

isWarnEnabled

  • isWarnEnabled(): boolean

trace

  • trace(msg: string, error?: Error | null): void
  • Parameters

    • msg: string
    • Optional error: Error | null

    Returns void

tracec

  • tracec(msg: function, error: function): void
  • Parameters

    • msg: function
        • (): string
        • Returns string

    • error: function
        • (): Error | null
        • Returns Error | null

    Returns void

warn

  • warn(msg: string, error?: Error | null): void
  • Parameters

    • msg: string
    • Optional error: Error | null

    Returns void

warnc

  • warnc(msg: function, error: function): void
  • Parameters

    • msg: function
        • (): string
        • Returns string

    • error: function
        • (): Error | null
        • Returns Error | null

    Returns void

Generated using TypeDoc