Cast Debug Logger

Cast Receiver SDK provides another option for developers to easily debug your receiver app by using CastDebugLogger API and a companion Command and Control (CaC) Tool to capture logs.


To use the CastDebugLogger API, include the following script in your receiver app right after the CAF Receiver SDK script:

<!-- CAF Receiver SDK -->
<script src="//"></script>
<!-- Cast Debug Logger -->
<script src="//"></script>

Create the CastDebugLogger object and enable the logger:

const castDebugLogger = cast.debug.CastDebugLogger.getInstance();

// Enable debug logger and show a 'DEBUG MODE' overlay at top left corner.

When the debug logger is enabled, an overlay displaying DEBUG MODE will show on the receiver.

Log Player Events

Using CastDebugLogger you can easily log player events that are fired by CAF Receiver SDK and use different logger levels to log the event data. The loggerLevelByEvents config takes and to specify the events to be logged.

For example, if you want to know when the player CORE events are triggered or a mediaStatus change is broadcasted, use the following config to log the events:

castDebugLogger.loggerLevelByEvents = {
  '': cast.framework.LoggerLevel.INFO,
  '': cast.framework.LoggerLevel.DEBUG

Log Custom Messages with Custom Tags

The CastDebugLogger API allows you to create log messages that appear on the receiver debug overlay with different colors. Use the following log methods, listed in order from highest to lowest priority:

  • castDebugLogger.error(custom_tag, message);
  • castDebugLogger.warn(custom_tag, message);
  •, message);
  • castDebugLogger.debug(custom_tag, message);

For each log method, the first parameter should be a custom tag and the second parameter is the log message. The tag can be any string that you find helpful.

Here is an example of how to use the debug logger in the LOAD interceptor.

const LOG_TAG = 'MyReceiverApp';

    request => {
        castDebugLogger.debug(LOG_TAG, 'Intercepting LOAD request');

        return new Promise((resolve, reject) => {
                data => {
                    let item = data[];
                    if (!item) {
                        castDebugLogger.error(LOG_TAG, 'Content not found');

                    } else {
                            'Playable URL:',;


You can control which messages appear on the debug overlay by setting the log level in loggerLevelByTags for each custom tag. For example, enabling a custom tag with log level cast.framework.LoggerLevel.DEBUG would display all messages added with error, warn, info, and debug log messages. Another example is that enabling a custom tag with WARNING level would only display error and warn log messages.

The loggerLevelByTags config is optional. If a custom tag is not configured for its logger level, all log messages will display on the debug overlay.

const LOG_TAG1 = 'Tag1';
const LOG_TAG2 = 'Tag2';

// Set verbosity level for custom tags
castDebugLogger.loggerLevelByTags = {
    [LOG_TAG1]: cast.framework.LoggerLevel.WARNING,
    [LOG_TAG2]: cast.framework.LoggerLevel.DEBUG,
castDebugLogger.debug(LOG_TAG1, 'debug log from tag1');, 'info log from tag1');
castDebugLogger.warn(LOG_TAG1, 'warn log from tag1');
castDebugLogger.error(LOG_TAG1, 'error log from tag1');

castDebugLogger.debug(LOG_TAG2, 'debug log from tag2');, 'info log from tag2');
castDebugLogger.warn(LOG_TAG2, 'warn log from tag2');
castDebugLogger.error(LOG_TAG2, 'error log from tag2');

// example outputs:
// [Tag1] [WARN] warn log from tag1
// [Tag1] [ERROR] error log from tag1
// [Tag2] [DEBUG] debug log from tag2
// [Tag2] [INFO] info log from tag2
// [Tag2] [WARN] warn log from tag2
// [Tag2] [ERROR] error log from tag2

Debug Overlay

The Cast Debug Logger provides a debug overlay on the receiver to show your custom log messages. Use showDebugLogs to toggle the debug overlay and clearDebugLogs to clear log messages on the overlay.

// Show debug overlay

// Clear log messages on debug overlay