Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Logger

Static singleton that represents the logging facility for Excalibur. Excalibur comes built-in with a ConsoleAppender and ScreenAppender. Derive from IAppender to create your own logging appenders.

Example: Logging

// set default log level (default: Info)
ex.Logger.getInstance().defaultLevel = ex.LogLevel.Warn;
// this will not be shown because it is below Warn
ex.Logger.getInstance().info('This will be logged as Info');
// this will show because it is Warn
ex.Logger.getInstance().warn('This will be logged as Warn');
// this will show because it is above Warn
ex.Logger.getInstance().error('This will be logged as Error');
// this will show because it is above Warn
ex.Logger.getInstance().fatal('This will be logged as Fatal');

Hierarchy

  • Logger

Index

Constructors

constructor

Properties

defaultLevel

defaultLevel: LogLevel = LogLevel.Info

Gets or sets the default logging level. Excalibur will only log messages if equal to or above this level. Default: LogLevel.Info

Methods

addAppender

clearAppenders

  • clearAppenders(): void
  • Clears all appenders from the logger

    Returns void

debug

  • debug(...args: any[]): void
  • Writes a log message at the LogLevel.Debug level

    Parameters

    • Rest ...args: any[]

      Accepts any number of arguments

    Returns void

error

  • error(...args: any[]): void
  • Writes a log message at the LogLevel.Error level

    Parameters

    • Rest ...args: any[]

      Accepts any number of arguments

    Returns void

fatal

  • fatal(...args: any[]): void
  • Writes a log message at the LogLevel.Fatal level

    Parameters

    • Rest ...args: any[]

      Accepts any number of arguments

    Returns void

info

  • info(...args: any[]): void
  • Writes a log message at the LogLevel.Info level

    Parameters

    • Rest ...args: any[]

      Accepts any number of arguments

    Returns void

warn

  • warn(...args: any[]): void
  • Writes a log message at the LogLevel.Warn level

    Parameters

    • Rest ...args: any[]

      Accepts any number of arguments

    Returns void

Static getInstance