Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Logger

Function to use instead of console.log.

It will print the logs in different colors and with more control

Hierarchy

  • Logger

Index

Properties

Private baseNamespace

baseNamespace: string = "baseLogger"

Namespace to use as identified in the console.log and also in the localStorage

Private source

source: string

Variable to use if we want to create logs of different sources (Component name e.g.)

Methods

disable

  • disable(): void
  • Function to disable the logger

    Returns void

enable

  • enable(): void
  • Function to enable the logger

    Returns void

error

  • error(message: string, source?: any): void
  • Function to create an error log

    Parameters

    • message: string

      message to log

    • Optional source: any

      the source related to the log message, Optional

    Returns void

generateMessage

  • generateMessage(level: string, message: string, source?: any): void
  • Function to log the message to the console

    Parameters

    • level: string

      type of message to log

    • message: string

      the message to print

    • Optional source: any

      the source related to the log message, Optional

    Returns void

getBaseNamespace

  • getBaseNamespace(): string
  • Function to get the base namespace to use in the localstorage

    Returns string

info

  • info(message: string, source?: any): void
  • Function to create an information log

    Parameters

    • message: string

      message to log

    • Optional source: any

      the source related to the log message, Optional

    Returns void

setBaseNamespace

  • setBaseNamespace(baseNamespace: string): string
  • Function to set the base namespace to use in the localstorage

    Parameters

    • baseNamespace: string

      string to use as namespace

    Returns string

setSource

  • setSource(source: string): string
  • Function to set the source context

    Parameters

    • source: string

      string to use as source

    Returns string

trace

  • trace(message: string, source?: any): void
  • Function to create a trace log

    Parameters

    • message: string

      message to log

    • Optional source: any

      the source related to the log message, Optional

    Returns void

warn

  • warn(message: string, source?: any): void
  • Function to create a warning log

    Parameters

    • message: string

      message to log

    • Optional source: any

      the source related to the log message, Optional

    Returns void

Generated using TypeDoc