Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Properties

alert

alert: ILog

Internal services (data store API calls failed, etc) or external services are failing

type

{ILog}

memberof

Logger

critical

critical: ILog

A user is now stuck in a broken state which the system cannot naturally repair

type

{ILog}

memberof

Logger

debug

debug: ILog

Game server debugging information

type

{ILog}

memberof

Logger

emergency

emergency: ILog

The app cannot boot or stopped unexpectedly

type

{ILog}

memberof

Logger

error

error: ILog

A user request caused an error. The user should still be able to continue using the services

type

{ILog}

memberof

Logger

info

info: ILog

User command request information

type

{ILog}

memberof

Logger

notice

notice: ILog
Services state change notification (example: third-party services and databases)
type

{ILog}

memberof

Logger

verbose

verbose: ILog

Low-level debug information (I/O details, etc). Reserved to MAGE internals

type

{ILog}

memberof

Logger

warning

warning: ILog

An unusual situation occurred, which requires analysis

type

{ILog}

memberof

Logger

Methods

addContexts

  • addContexts(...contexts: string[]): void
  • Add contexts to the current logger instance.

    Logging contexts should be used to help with the triage and filtering of logs; for instance, you will often want to create one logger context per module.

    This adds contexts to the current instance. You will not normally want to use this on the global logger instance: instead, you will normally want to use this on a logger instance returned by mage.logger.context or something similar.

    import * as mage from mage;
    const logger = mage.logger.context('mymodule')
    logger.addContexts('some other context to add')
    logger.debug('this will be contextualized to mymodule')
    

    In most cases, simply using mage.logger.context is sufficient.

    memberof

    Logger

    Parameters

    • Rest ...contexts: string[]

    Returns void

context

  • context(...contexts: string[]): Logger
  • Return a contextualized logger instance

    Logging contexts should be used to help with the triage and filtering of logs; for instance, you will often want to create one logger context per module.

    Contrarily to mage.logger.addContexts, this method returns a new logger with the given context, instead of setting the context on the current logger instance. This can be useful to create a localized logger;

    import * as mage from mage;
    const logger = mage.logger.context('mymodule')
    logger.debug('this will be contextualized to mymodule')
    
    summary

    Append a logging context.

    memberof

    Logger

    Parameters

    • Rest ...contexts: string[]

    Returns Logger

disableChannel

  • disableChannel(channelName: string): void
  • Disable a log channel

    This will in effect take all logs sent to this channel, and ignore them; logs sent on this channel will no longer be forwarded to any logger backend.

    memberof

    Logger

    Parameters

    • channelName: string

      The name of the channel to disable

    Returns void

enableChannel

  • enableChannel(channelName: string): void
  • Create a channel handler

    You should only call this if you want to programatically enable a channel which is not currently enabled or if you want to re-enable a channel which was disabled using disableChannel.

    memberof

    Logger

    Parameters

    • channelName: string

      The channel to enable

    Returns void