Options
All
  • Public
  • Public/Protected
  • All
Menu

Note(Kelosky): it seems from the log4js doc that you only get a single instance of log4js per category. To reconfigure, you should "shutdown" logger.

Hierarchy

  • Logger

Index

Constructors

constructor

  • new Logger(mJsLogger: log4js.Logger | Console, category?: string): Logger

Properties

Private Optional category

category: string

Private initStatus

initStatus: boolean

This flag is being used to monitor the log4js configure status.

Private mJsLogger

mJsLogger: log4js.Logger | Console

Static Readonly DEFAULT_APP_NAME

DEFAULT_APP_NAME: "app" = "app"

Static Readonly DEFAULT_CONSOLE_NAME

DEFAULT_CONSOLE_NAME: "console" = "console"

Static Readonly DEFAULT_IMPERATIVE_NAME

DEFAULT_IMPERATIVE_NAME: "imperative" = "imperative"

Static Readonly DEFAULT_VALID_LOG_LEVELS

DEFAULT_VALID_LOG_LEVELS: string[] = ["ALL", "TRACE", "DEBUG", "INFO", "WARN", "ERROR", "FATAL", "MARK", "OFF"]

Accessors

level

  • get level(): string
  • set level(level: string): void

Private logService

  • get logService(): any
  • set logService(service: log4js.Logger | Console): void
  • Get underlying logger service

    This function also check to see if log4js is configured since the last time it was called. If yes, then update the logger with to leverage the new configuration.

    Returns any

  • Set underlying logger service

    This function also check to see if log4js is configured since the last time it was called. If yes, then update the logger with to leverage the new configuration.

    Parameters

    Returns void

Methods

debug

  • debug(message: string, ...args: any[]): string
  • Log a message at the "debug" level Example: 'Got cheese'

    Parameters

    • message: string

      printf or mustache style template string, or a plain string message

    • Rest ...args: any[]

      printf or mustache style args

    Returns string

error

  • error(message: string, ...args: any[]): string
  • Log a message at the "error" level Example: 'Cheese is too ripe!'

    Parameters

    • message: string

      printf or mustache style template string, or a plain string message

    • Rest ...args: any[]

      printf or mustache style args

    Returns string

fatal

  • fatal(message: string, ...args: any[]): string
  • Log a message at the "fatal" level Example: 'Cheese was breeding ground for listeria.'

    Parameters

    • message: string

      printf or mustache style template string, or a plain string message

    • Rest ...args: any[]

      printf or mustache style args

    Returns string

Private getCallerFileAndLineTag

  • getCallerFileAndLineTag(): string
  • Obtain .js file name and line number which issued the log message. NOTE(Kelosky): Consensus seems to be that this may produce a lot of overhead by creating an Error and obtaining stack information for EVERY log message that is issued.

    There are also packages available to obtain the appropriate line number.

    Perhaps when a package pops up that gives the appropriate .ts line number and file name, we'll remove usage of this method.

    Returns string

    • file and line number

info

  • info(message: string, ...args: any[]): string
  • Log a message at the "info" level Example: 'Cheese is Gouda'

    Parameters

    • message: string

      printf or mustache style template string, or a plain string message

    • Rest ...args: any[]

      printf or mustache style args

    Returns string

logError

simple

  • simple(message: string, ...args: any[]): string
  • Log a message without CallerFileAndLineTag Example: 'Cheese that is plain'

    Parameters

    • message: string

      printf or mustache style template string, or a plain string message

    • Rest ...args: any[]

      printf or mustache style args

    Returns string

trace

  • trace(message: string, ...args: any[]): string
  • Log a message at the "trace" level Example: 'Entering cheese testing'

    Parameters

    • message: string

      printf style template string, or a plain string message

    • Rest ...args: any[]

      printf style args

    Returns string

warn

  • warn(message: string, ...args: any[]): string
  • Log a message at the "warn" level Example: 'Cheese is quite smelly.'

    Parameters

    • message: string

      printf or mustache style template string, or a plain string message

    • Rest ...args: any[]

      printf or mustache style args

    Returns string

Static getAppLogger

Static getConsoleLogger

  • Return an instance to the console logger which applies TextUtils invoked through this Logger class.

    Note(Kelosky): this is not the same as obtaining a new Console() directly, since we can make use of the internationalization and other routines within this Logger class via this implementation.

    Returns Logger

    • instance of logger set to our app's category

Static getImperativeLogger

  • getImperativeLogger(): Logger

Static getLoggerCategory

  • getLoggerCategory(category: string): Logger
  • Get accessibility to logging service to invoke log calls, e.g Logger.getLogger.info("important log info goes here");

    Parameters

    • category: string

      category of logger to obtain

    Returns Logger

    • instance of logger set to our app's category

Static initLogger

Static isValidLevel

  • isValidLevel(testLevel: string): boolean

Static setLogInMemory

  • setLogInMemory(status: boolean, maxQueueSize?: number): void

Static writeInMemoryMessages

  • writeInMemoryMessages(file: string): void

Generated using TypeDoc