Skip to main content

Logging & Debugging

The fl-foundation library aims at abstracting away Platform dependent functionality and expose a platform-agnostic API for the consuming modules.

It primarily focuses on following features:

  1. Networking using FLRequest
  2. Storage using FLDataStore
  3. Logging using FLConsoleLogger

Console Logger

One can create a Logger instance as follows:

Log to console code snippet
  logger = FLFoundationFactory().loggerBuilder().tag("My logger tag").maxVerboseLevel(LoggingLevel().TRACE).build()
contextInfo = "onPlayerStateChanged called"
lineNumber = 50
logger.trace(contextInfo, lineNumber, "Entering a function")
logger.debug(contextInfo, lineNumber,"response is m.response")
logger.info(contextInfo, lineNumber,"An information message")
logger.warn(contextInfo, lineNumber,"Malformed data")
logger.error(contextInfo, lineNumber,"An error occurred")

Following Logger Levels are supported (ordered in terms of verbosity from the most to the least):

  1. TRACE
  2. DEBUG
  3. INFO
  4. WARN
  5. ERROR

Enable Logger for Debug or Release builds

The logger supports restricting log levels for debug and release build using manifest constants. The feature flag debug when turned off will restrict log levels to only Errors and when turned on no restrictions enforced.

Enable or Disable Debug
#Quickplay constants
bs_const=debug=false

It is suggested to set debug flag true for debuggging purposes and turn it off for release builds to avoid logging messages to console.