Package com.castlabs.logutils

# Class Crashlog

java.lang.Object
com.castlabs.logutils.Crashlog

public final class Crashlog extends Object
This class provides the ability to manager the crash context and connect `CrashReporter` implementations that are then used to send crash data to a backend service.

The `Crashlog` provides static method to report non-fatal error, add log lines, and add key/value pairs to the current context. The log lines and the key/value pairs might then be send to a backend service using a registered `CrashReporter`.

Please note that no reported is setup buy default. You will need to either use an existing plugin to integrate a crash reporting backend, or implement the `CrashReporter` interface and add the reporter using `addReporter(CrashReporter)`.

Since:
  3.0.0

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `KEY_ASSET_ID`
  Key used to store the last used asset ID
  `static final String`
  `KEY_AUDIO_BITRATE`
  Key used to store the current audio bitrate
  `static final String`
  `KEY_AUDIO_DRM`
  Key used to store the last used DRM type
  `static final String`
  `KEY_DEVICE_SECURITY_LEVEL`
  Key used to store the last required security level
  `static final String`
  `KEY_DISPLAY_COUNT`
  Key used to store the current number of reported displays
  `static final String`
  `KEY_DISPLAY_REMOTE`
  Key used to store a boolean that indicates if the connected display is a remote display
  `static final String`
  `KEY_DISPLAY_SECURE`
  Key used to store a boolean that indicates if the connected display is a secure display
  `static final String`
  `KEY_DISPLAY_SETTING`
  Key used to store the current display configuration
  `static final String`
  `KEY_DRM`
  Key used to store the last used DRM type
  `static final String`
  `KEY_DRM_URL`
  Key used to store the DRM backend URL for the last request
  `static final String`
  `KEY_OFFLINE_ID`
  Key used to store the Offline ID in case offline key storage is enabled
  `static final String`
  `KEY_POSITION`
  Key used to store the current playback position.
  `static final String`
  `KEY_PRESENTATION_DISPLAY_COUNT`
  Key used to store the current number of reported presentation displays
  `static final String`
  `KEY_REQUEST_ID`
  Key used to store the last used DRMToday request ID
  `static final String`
  `KEY_STATE`
  Key used to store the current playback state
  `static final String`
  `KEY_URL`
  Key used to store the current playback URL
  `static final String`
  `KEY_VARIANT_ID`
  Key used to store the last used variant ID
  `static final String`
  `KEY_VERSION`
  Key used to store the castlabs SDK version
  `static final String`
  `KEY_VIDEO_BITRATE`
  Key used to store the current video bitrate
  `static final String`
  `KEY_VIDEO_SIZE`
  Key used to store the current video dimensions

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `addReporter(CrashReporter connection)`
  Add a new reporter
  `static void`
  `log(String tag, String message)`
  Adds a log line to the crash context
  `static void`
  `report(Throwable exception)`
  Report a caught exception to all registered reporters
  `static void`
  `set(String key, boolean value)`
  Sets a boolean value.
  `static void`
  `set(String key, double value)`
  Sets a double value.
  `static void`
  `set(String key, int value)`
  Sets an int value.
  `static void`
  `set(String key, String value)`
  Sets a string value.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### KEY_URL

    public static final String KEY_URL
    Key used to store the current playback URL
    See Also:
      - Constant Field Values

  - ### KEY_DRM_URL

    public static final String KEY_DRM_URL
    Key used to store the DRM backend URL for the last request
    See Also:
      - Constant Field Values

  - ### KEY_OFFLINE_ID

    public static final String KEY_OFFLINE_ID
    Key used to store the Offline ID in case offline key storage is enabled
    See Also:
      - Constant Field Values

  - ### KEY_REQUEST_ID

    public static final String KEY_REQUEST_ID
    Key used to store the last used DRMToday request ID
    See Also:
      - Constant Field Values

  - ### KEY_ASSET_ID

    public static final String KEY_ASSET_ID
    Key used to store the last used asset ID
    See Also:
      - Constant Field Values

  - ### KEY_VARIANT_ID

    public static final String KEY_VARIANT_ID
    Key used to store the last used variant ID
    See Also:
      - Constant Field Values

  - ### KEY_DRM

    public static final String KEY_DRM
    Key used to store the last used DRM type
    See Also:
      - Constant Field Values

  - ### KEY_AUDIO_DRM

    public static final String KEY_AUDIO_DRM
    Key used to store the last used DRM type
    See Also:
      - Constant Field Values

  - ### KEY_DEVICE_SECURITY_LEVEL

    public static final String KEY_DEVICE_SECURITY_LEVEL
    Key used to store the last required security level
    See Also:
      - Constant Field Values

  - ### KEY_STATE

    public static final String KEY_STATE
    Key used to store the current playback state
    See Also:
      - Constant Field Values

  - ### KEY_VERSION

    public static final String KEY_VERSION
    Key used to store the castlabs SDK version
    See Also:
      - Constant Field Values

  - ### KEY_VIDEO_SIZE

    public static final String KEY_VIDEO_SIZE
    Key used to store the current video dimensions
    See Also:
      - Constant Field Values

  - ### KEY_VIDEO_BITRATE

    public static final String KEY_VIDEO_BITRATE
    Key used to store the current video bitrate
    See Also:
      - Constant Field Values

  - ### KEY_AUDIO_BITRATE

    public static final String KEY_AUDIO_BITRATE
    Key used to store the current audio bitrate
    See Also:
      - Constant Field Values

  - ### KEY_DISPLAY_SETTING

    public static final String KEY_DISPLAY_SETTING
    Key used to store the current display configuration
    See Also:
      - Constant Field Values

  - ### KEY_DISPLAY_COUNT

    public static final String KEY_DISPLAY_COUNT
    Key used to store the current number of reported displays
    See Also:
      - Constant Field Values

  - ### KEY_PRESENTATION_DISPLAY_COUNT

    public static final String KEY_PRESENTATION_DISPLAY_COUNT
    Key used to store the current number of reported presentation displays
    See Also:
      - Constant Field Values

  - ### KEY_DISPLAY_REMOTE

    public static final String KEY_DISPLAY_REMOTE
    Key used to store a boolean that indicates if the connected display is a remote display
    See Also:
      - Constant Field Values

  - ### KEY_DISPLAY_SECURE

    public static final String KEY_DISPLAY_SECURE
    Key used to store a boolean that indicates if the connected display is a secure display
    See Also:
      - Constant Field Values

  - ### KEY_POSITION

    public static final String KEY_POSITION
    Key used to store the current playback position. This will be updated at most with a resolution of 1 Second.
    See Also:
      - Constant Field Values

- ## Method Details

  - ### report

    public static void report(Throwable exception)
    Report a caught exception to all registered reporters
    Parameters:
      `exception` - the exception

  - ### log

    public static void log(String tag, String message)
    Adds a log line to the crash context
    Parameters:
      `tag` - The tag
      `message` - The log message

  - ### set

    public static void set(String key, String value)
    Sets a string value.

    Key value pairs like this should be send when a crash is recorder and will help to debug the issue.

    Parameters:
      `key` - the key
      `value` - the value

  - ### set

    public static void set(String key, int value)
    Sets an int value.

    Key value pairs like this should be send when a crash is recorder and will help to debug the issue.

    Parameters:
      `key` - the key
      `value` - the value

  - ### set

    public static void set(String key, double value)
    Sets a double value.

    Key value pairs like this should be send when a crash is recorder and will help to debug the issue.

    Parameters:
      `key` - the key
      `value` - the value

  - ### set

    public static void set(String key, boolean value)
    Sets a boolean value.

    Key value pairs like this should be send when a crash is recorder and will help to debug the issue.

    Parameters:
      `key` - the key
      `value` - the value

  - ### addReporter

    public static void addReporter(@NonNull CrashReporter connection)
    Add a new reporter
    Parameters:
      `connection` - the reporter instance