Logger

  
class Logger implements LoggerService {
  protected static logBuffer: Array<LogBufferRecord>
  protected static staticInstanceRef?: LoggerService
  protected static logLevels?: LogLevel[]
  static error(message: any, ...optionalParams: any[])
  static log(message: any, ...optionalParams: any[])
  static warn(message: any, ...optionalParams: any[])
  static debug(message: any, ...optionalParams: any[])
  static verbose(message: any, ...optionalParams: any[])
  static flush()
  static attachBuffer()
  static detachBuffer()
  static getTimestamp()
  static overrideLogger(logger: boolean | LoggerService | LogLevel[])
  static isLevelEnabled(level: LogLevel): boolean
  protected localInstanceRef?: LoggerService
  protected context?: string
  protected options: {...}
  localInstance: LoggerService
  error(message: any, ...optionalParams: any[])
  log(message: any, ...optionalParams: any[])
  warn(message: any, ...optionalParams: any[])
  debug(message: any, ...optionalParams: any[])
  verbose(message: any, ...optionalParams: any[])
}

Static properties

Property Description
protected static logBuffer: Array<LogBufferRecord>
protected static staticInstanceRef?: LoggerService
protected static logLevels?: LogLevel[]

Static methods

error()

Overload #1

Write an 'error' level log.


static error(message: any, context?: string): void

Parameters

Option Type Description
message any
context string

Optional. Default is undefined.

Returns

void


Overload #2

static error(message: any, stack?: string, context?: string): void

Parameters

Option Type Description
message any
stack string

Optional. Default is undefined.

context string

Optional. Default is undefined.

Returns

void


Overload #3

static error(message: any, ...optionalParams: any[]): void

Parameters

Option Type Description
message any
optionalParams any[]

Returns

void

log()

Write a 'log' level log.


static log(message: any, context?: string): void

Parameters

Option Type Description
message any
context string

Optional. Default is undefined.

Returns

void


static log(message: any, ...optionalParams: any[]): void

Parameters

Option Type Description
message any
optionalParams any[]

Returns

void

warn()

Write a 'warn' level log.


static warn(message: any, context?: string): void

Parameters

Option Type Description
message any
context string

Optional. Default is undefined.

Returns

void


static warn(message: any, ...optionalParams: any[]): void

Parameters

Option Type Description
message any
optionalParams any[]

Returns

void

debug()

Write a 'debug' level log, if the configured level allows for it. Prints to stdout with newline.


static debug(message: any, context?: string): void

Parameters

Option Type Description
message any
context string

Optional. Default is undefined.

Returns

void


static debug(message: any, ...optionalParams: any[]): void

Parameters

Option Type Description
message any
optionalParams any[]

Returns

void

verbose()

Write a 'verbose' level log.


static verbose(message: any, context?: string): void

Parameters

Option Type Description
message any
context string

Optional. Default is undefined.

Returns

void


static verbose(message: any, ...optionalParams: any[]): void

Parameters

Option Type Description
message any
optionalParams any[]

Returns

void

flush()

Print buffered logs and detach buffer.


static flush()

Parameters

There are no parameters.

attachBuffer()

Attach buffer. Turns on initialization logs buffering.


static attachBuffer()

Parameters

There are no parameters.

detachBuffer()

Detach buffer. Turns off initialization logs buffering.


static detachBuffer()

Parameters

There are no parameters.

getTimestamp()


static getTimestamp()

Parameters

There are no parameters.

overrideLogger()


static overrideLogger(logger: boolean | LoggerService | LogLevel[])

Parameters

Option Type Description
logger boolean | LoggerService | LogLevel[]

isLevelEnabled()


static isLevelEnabled(level: LogLevel): boolean

Parameters

Option Type Description
level LogLevel

Returns

boolean

Properties

Property Description
protected localInstanceRef?: LoggerService
protected context?: string
protected options: { timestamp?: boolean; }
localInstance: LoggerService Read-only.

Methods

error()

Write an 'error' level log.


error(message: any, stack?: string, context?: string): void

Parameters

Option Type Description
message any
stack string

Optional. Default is undefined.

context string

Optional. Default is undefined.

Returns

void


error(message: any, ...optionalParams: any[]): void

Parameters

Option Type Description
message any
optionalParams any[]

Returns

void

log()

Write a 'log' level log.


log(message: any, context?: string): void

Parameters

Option Type Description
message any
context string

Optional. Default is undefined.

Returns

void


log(message: any, ...optionalParams: any[]): void

Parameters

Option Type Description
message any
optionalParams any[]

Returns

void

warn()

Write a 'warn' level log.


warn(message: any, context?: string): void

Parameters

Option Type Description
message any
context string

Optional. Default is undefined.

Returns

void


warn(message: any, ...optionalParams: any[]): void

Parameters

Option Type Description
message any
optionalParams any[]

Returns

void

debug()

Write a 'debug' level log.


debug(message: any, context?: string): void

Parameters

Option Type Description
message any
context string

Optional. Default is undefined.

Returns

void


debug(message: any, ...optionalParams: any[]): void

Parameters

Option Type Description
message any
optionalParams any[]

Returns

void

verbose()

Write a 'verbose' level log.


verbose(message: any, context?: string): void

Parameters

Option Type Description
message any
context string

Optional. Default is undefined.

Returns

void


verbose(message: any, ...optionalParams: any[]): void

Parameters

Option Type Description
message any
optionalParams any[]

Returns

void