waytale - v0.5.1
    Preparing search index...

    Class Logger

    Helper class for better logging to console. Provides some more salient visuals, filtering by log severity and inclusion or exclusion of log messages.

    This class will respect the file names and line numbers of the locations in code where the log message arised, without relying on source maps. The trick is to combine partials (bound functions) with ES class getters to redirect calls to console.*().

    If logger inclusion is specified, any log message must originate from an included logger. If no inclusion is specified, this feature is ignore. Any specified exclusion of loggers is always applied.

    Index

    Constructors

    • Create a new logger with a set identifier.

      Parameters

      • name: any

        name of the new logger

      Returns Logger

    Properties

    name: any
    LEVEL_DEBUG: number = 1
    LEVEL_ERROR: number = 5
    LEVEL_INFO: number = 3
    LEVEL_LOG: number = 2
    LEVEL_WARN: number = 4

    Accessors

    • get debug(): LogFunction

      Returns LogFunction

      • return function to log with level debug
    • get error(): LogFunction

      Returns LogFunction

      • return function to log with level error
    • get info(): LogFunction

      Returns LogFunction

      • return function to log with level info
    • get log(): LogFunction

      Returns LogFunction

      • return function to log with level log
    • get warn(): LogFunction

      Returns LogFunction

      • return function to log with level warn

    Methods

    • Exclude a list of loggers by name.

      Parameters

      • names: any

        names of loggers to exclude from log output

      Returns void

    • Include a list of loggers by name.

      Parameters

      • names: any

        names of loggers to include in log output

      Returns void

    • Set global log severity level.

      Parameters

      • level: any

        level to set to

      Returns void