Skip to content

Add log level feature

Vinay Rosenberg requested to merge github/fork/epiclabsDASH/log-levels into development

Created by: epiclabsDASH

Improves the logging system so it works with log levels (as requested in #2601 (closed)).

A couple of methods have been created in Debug class to allow developers to set/retrieve the log level:

  • Debug.setLogLevel
  • Debug.getLogLevel

The following log levels are supported:

  • dashjs.Debug.LOG_LEVEL_DEBUG: what we have today. Everything.
  • dashjs.Debug.LOG_LEVEL_INFO: key events (ex: segment loaded, bitrate changes).
  • dashjs.Debug.LOG_LEVEL_WARNING: (ex: timecode jumping, fetch is not available, EME not available, adaptations set that are not supported, semantic problems with the mpd that dont avoid playback to start).
  • dashjs.Debug.LOG_LEVEL_ERROR: errors that don't stop playback (ex: segment 404, codec errors - fallback).
  • dashjs.Debug.LOG_LEVEL_FATAL: Playback fails completely (codecs not supported).

With the new approach, any dash.js class that wants to use the new Logger has to create its own Logger instance. Example:

logger = Debug(context).getInstance().getLogger(instance);
logger.warn('This is a warning message');

Additionally:

  • Method Debug.setLogToBrowserConsole has been deprecated and will be removed two versions after current one (v2.7.0)
  • Method Debug.getLogToBrowserConsole has been deprecated and will be removed two versions after current one (v2.7.0)
  • Event Events.LOG has been deprecated and will be removed two versions after current one (v2.7.0)

Documentation, definition file and unit tests updated.

Merge request reports