Platform, Logging and Error Information

Platform and SDK Version Information

The SDK provides APIs for retrieving detailed information about the platform and device the application is running on as well as version information about the SDK itself.

// Retrieve the SDK version information
NSLog(@"SDK Version Information: %@", [WZVersionInfo string]);
// Retrieve the device and platform information
NSLog(@"Platform and Device Information: %@", [WZPlatformInfo string]);
// 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);

Status and Error Reporting

An instance of the WZStatus class is used with many of the SDK APIs to return detailed information about the status of a component or process. The WZStatus class contains a state property that indicates whether a component such as a broadcast stream is stopped or running and an error property that will contain detailed information if an error has occurred.

  • The error property of the WZStatus class in the GoCoder SDK for iOS is an instance of the standard iOS NSError class.

  • The WZStatus class in the GoCoder SDK for Android has a getLastError() method that returns an instance of a WZError class that is provided with the GoCoder SDK.

// Retrieve the SDK status and check for an error
if (self.goCoderSDK.status.state == WZStateIdle && self.goCoderSDK.status.error != nil) {
    NSLog(@"An SDK error occurred: %@", [self.goCoderSDK.status.error localizedDescription]);
}
// 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());
}

Logging

The SDK uses the iOS NSLog facility to send log output.

The SDK includes the WZLog class with static methods for sending log messages at various levels.

When used in it's default configuration, WZLog is a wrapper class for the Log utility class included in the Android SDK. However, the WZLogger interface can be used to integrate the SDK with alternate logging facilities.

Example: Developing a custom logger class

The MyLogger class in the example serves as a wrapper around the SysLogger logging 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);