How to view logs and reports with Wowza GoCoder SDK for Android

This article describes how to collect device information, status and error reports, and logs with Wowza GoCoder™ SDK for Android.

Contents


Collect device and SDK information
Collect status and error reports
Collect logs

Collect device and SDK information


The following video demonstrates how to collect the device and SDK information for your setup:

Use the SDK_VERSION and PLATFORM_INFO APIs in the WowzaGoCoder class, respectively, to retrieve information about the Wowza GoCoder SDK version and the device running the app.

// Retrieve the SDK version information
WZLog.info(TAG, "SDK Version Information: " + WowzaGoCoder.SDK_VERSION);
// Retrieve the device and platform information
WZLog.info(TAG, "Platform and Device Information: " + WowzaGoCoder.PLATFORM_INFO);

Collect status and error reports


Many of the Wowza GoCoder SDK APIs use instances of the WZStatus class to return the status of components and processes. The WZStatus class contains two properties:

  • State indicates that a component, such as a broadcast stream, is running or stopped.
  • Error indicates that an error occurred. The getLastError() method in the WZStatus class returns an instance of the WZError class.

The following example demonstrates how to check the status for an error.

// Retrieve the SDK status and check for an error
if (mGoCoder.getStatus == WZState.IDLE && mGoCoder.getStatus.getLastError() != null) {
  WZLog.error(TAG, "An SDK error occurred: " + mGoCoder.getStatus.getLastError().getErrorDescription());
}

Collect logs


Use the WZLog class to send log messages at various levels. When used in the default configuration, WZLog is a wrapper class for the Android SDK Log utility class. You can also use the WZLogger interface to integrate the Wowza GoCoder SDK with other logging facilities.

The following example demonstrates how to extend the WZLogger interface to wrap the SysLogger class.

// A custom logger class for the GoCoder SDK
public class MyLogger extends WZLogger {

   public MyLogger() {
   }

   @Override
   public void info(String tag, String message) {
    SysLogger.i(tag, message);
   }
   @Override
   public void debug(String tag, String message) {
    SysLogger.d(tag, message);
   }

   @Override
   public void warn(String tag, String message) {
    SysLogger.w(tag, message);
   }

   @Override
   public void error(String tag, String message) {
     SysLogger.e(tag, message);
   }

   @Override
   public void error(String tag, String message, Throwable throwable) {
     SysLogger.e(tag, message, throwable);
   }

   @Override
   public void error(String tag, Throwable throwable) {
     SysLogger.e(tag, throwable);
   }
}

// Create an instance of the custom logger class
MyLogger customLogger = new MyLogger();
// Register the instance with the SDK logger
WZLog.registerLogger(customLogger);

If you're having problems or want to discuss this article, post in our forum.