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 Appender 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

debug

  • debug(...args: any[]): void

error

  • error(...args: any[]): void

fatal

  • fatal(...args: any[]): void

info

  • info(...args: any[]): void

warn

  • warn(...args: any[]): void

Static getInstance