Class: Logger

Exitgames.Common. Logger

Logger with ability to control logging level. Prints messages to browser console. Each logging method perfoms toString() calls and default formatting of arguments only after it checks logging level. Therefore disabled level logging method call with plain arguments doesn't involves much overhead. But if one prefer custom formatting or some calculation for logging methods arguments he should check logging level before doing this to avoid unnecessary operations: if(logger.isLevelEnabled(Logger.Level.DEBUG)) { logger.debug("", someCall(x, y), x + "," + y); }

new Logger(prefix, level)

Parameters:
Name Type Argument Default Description
prefix string <optional>
"" All log messages will be prefixed with that.
level Exitgames.Common.Logger.Level <optional>
Level.INFO Initial logging level.
Source:
  • Photon-Javascript_SDK.js, line 564

Methods

debug(mess, optionalParams)

Logs message if logging level = DEBUG, INFO, WARN, ERROR

Parameters:
Name Type Description
mess string Message to log.
optionalParams any For every additional parameter toString() applies and result added to the end of log message after space character.
Source:
  • Photon-Javascript_SDK.js, line 612

error(mess, optionalParams)

Logs message if logging level = ERROR

Parameters:
Name Type Description
mess string Message to log.
optionalParams any For every additional parameter toString() applies and result added to the end of log message after space character.
Source:
  • Photon-Javascript_SDK.js, line 654

format(mess, optionalParams) → {string}

Applies default logger formatting to arguments

Parameters:
Name Type Description
mess string String to start formatting with.
optionalParams any For every additional parameter toString() applies and result added to the end of formatted string after space character.
Source:
  • Photon-Javascript_SDK.js, line 668
Returns:
Formatted string.
Type
string

format(mess, optionalParams) → {string}

Applies default logger formatting to array of objects.

Parameters:
Name Type Description
mess string String to start formatting with.
optionalParams any[] For every additional parameter toString() applies and result added to the end of formatted string after space character.
Source:
  • Photon-Javascript_SDK.js, line 683
Returns:
Formatted string.
Type
string

getLevel() → {Exitgames.Common.Logger.Level}

Returns current logging level.

Source:
  • Photon-Javascript_SDK.js, line 603
Returns:
Current logging level.
Type
Exitgames.Common.Logger.Level

info(mess, optionalParams)

Logs message if logging level = INFO, WARN, ERROR

Parameters:
Name Type Description
mess string Message to log.
optionalParams any For every additional parameter toString() applies and result added to the end of log message after space character.
Source:
  • Photon-Javascript_SDK.js, line 626

isLevelEnabled(level) → {boolean}

Checks if logging level active.

Parameters:
Name Type Description
level Exitgames.Common.Logger.Level Level to check.
Source:
  • Photon-Javascript_SDK.js, line 593
Returns:
True if level active.
Type
boolean

setLevel(level)

Changes current logging level.

Parameters:
Name Type Description
level Exitgames.Common.Logger.Level New logging level.
Source:
  • Photon-Javascript_SDK.js, line 582

warn(mess, optionalParams)

Logs message if logging level = WARN, ERROR

Parameters:
Name Type Description
mess string Message to log.
optionalParams any For every additional parameter toString() applies and result added to the end of log message after space character.
Source:
  • Photon-Javascript_SDK.js, line 640