Home Reference Source Repository
import Log4jsLogger from 'monyt/src/logger/Log4jsLogger.js'
public class | source

Log4jsLogger

Extends:

Logger → Log4jsLogger

Static Method Summary

Static Public Methods
public static

addAppender(objectPattern: {"type": *, "layout": *, "config": *, "category": *})

public static

getCoreLogger(options: *): *

public static
public static

initCore(): *

public static
public static

replaceAppender(appenders: ...*)

Constructor Summary

Public Constructor
public

Static Public Methods

public static addAppender(objectPattern: {"type": *, "layout": *, "config": *, "category": *}) source

Params:

NameTypeAttributeDescription
objectPattern {"type": *, "layout": *, "config": *, "category": *}
  • default: {"type":null,"layout":null,"config":null,"category":null}

public static getCoreLogger(options: *): * source

Params:

NameTypeAttributeDescription
options *

Return:

*

public static getLogger(options: Object): Log4jsLogger source

Params:

NameTypeAttributeDescription
options Object
  • optional
  • default: {category:

'app', level: 'info', replaceConsole: false}] - Options to initialize logger instance.

options.category string
  • optional
  • default: app

Category of logger.

options.level string
  • optional
  • default: info

Level to log.

options.replaceConsole boolean
  • optional
  • default: false

Flag to switch replaceConsole options.

Return:

Log4jsLogger

new Log4jsLogger Instance.

public static initCore(): * source

Return:

*

public static logMiddleware(options: Object): Function source

Params:

NameTypeAttributeDescription
options Object
  • optional
  • default: {}

Options to setup logMiddleware().

options.category string
  • optional
  • default: request

Category name of request logger.

options.category string
  • optional
  • default: auto

Level to log.

options.format string
  • optional
  • default: :method

:url :status :content-length - :response-time ms] - Log format of request logger.

Return:

Function

connect/express middleware to logging requests.

public static replaceAppender(appenders: ...*) source

Params:

NameTypeAttributeDescription
appenders ...*

Public Constructors

public constructor(options: Object): Log4jsLogger source

Override:

Logger#constructor

Params:

NameTypeAttributeDescription
options Object
  • optional
  • default: {}

Options to initialize logger instance.

options.category string
  • optional
  • default: app

Category of logger.

options.level string
  • optional
  • default: info

Level to log.

options.replaceConsole boolean
  • optional
  • default: false

Flag to switch replaceConsole options.

Return:

Log4jsLogger

new Log4jsLogger Instance.