Class Log

java.lang.Object
com.brightcove.player.logging.Log

public class Log extends Object
A simple wrapper for Log that supports log message formatting and turning on or off logging based on tag.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static @interface 
    The list of possible of logging levels.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The level for debug log messages.
    static final int
    The level for error log messages.
    static final int
    The level for information log messages.
    static final int
    The level for verbose log messages.
    static final int
    The level for warning log messages.
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    d(String tag, String message, Object... arguments)
    Logs a debug message.
    static int
    d(String tag, String message, Throwable error, Object... arguments)
    Logs a debug message.
    static int
    e(String tag, String message, Object... arguments)
    Logs an error message.
    static int
    e(String tag, String message, Throwable error, Object... arguments)
    Logs an error message.
    static int
    i(String tag, String message, Object... arguments)
    Logs an information message.
    static int
    i(String tag, String message, Throwable error, Object... arguments)
    Logs an information message.
    static boolean
    isLoggable(String tag, int level)
    Checks to see whether or not a log for the specified tag is loggable at the specified level.
    static int
    v(String tag, String message, Object... arguments)
    Logs a verbose message.
    static int
    v(String tag, String message, Throwable error, Object... arguments)
    Logs a verbose message.
    static int
    w(String tag, String message, Object... arguments)
    Logs a warning message.
    static int
    w(String tag, String message, Throwable error, Object... arguments)
    Logs a warning message.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEBUG

      public static final int DEBUG
      The level for debug log messages.
      See Also:
    • ERROR

      public static final int ERROR
      The level for error log messages.
      See Also:
    • INFO

      public static final int INFO
      The level for information log messages.
      See Also:
    • VERBOSE

      public static final int VERBOSE
      The level for verbose log messages.
      See Also:
    • WARN

      public static final int WARN
      The level for warning log messages.
      See Also:
  • Method Details

    • isLoggable

      public static boolean isLoggable(@NonNull String tag, int level)
      Checks to see whether or not a log for the specified tag is loggable at the specified level. The default level of any tag is set to INFO. This means that any level above and including INFO will be logged. Before you make any calls to a logging method you should check to see if your tag should be logged. You can change the default level by setting a system property: 'setprop log.tag. ' Where level is either VERBOSE, DEBUG, INFO, WARN, ERROR, ASSERT, or SUPPRESS. SUPPRESS will turn off all logging for your tag. You can also create a local.prop file that with the following in it: 'log.tag.=' and place that in /data/local.prop.
      Parameters:
      tag - The tag to check.
      level - The level to check.
      Returns:
      true if the tag this is allowed to be logged, otherwise false.
    • v

      public static int v(@NonNull String tag, @NonNull String message, Object... arguments)
      Logs a verbose message.
      Parameters:
      tag - the string that will ssed to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
      message - the message to be logged. The message may contain formatting token supported by String.format(String, Object...) method.
      arguments - an array of objects to be used for formatting the log message.
      Returns:
      The number of bytes written.
    • v

      public static int v(@NonNull String tag, @NonNull String message, Throwable error, Object... arguments)
      Logs a verbose message.
      Parameters:
      tag - the string that will ssed to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
      message - the message to be logged. The message may contain formatting token supported by String.format(String, Object...) method.
      error - the error to be logged, if any.
      arguments - an array of objects to be used for formatting the log message.
      Returns:
      The number of bytes written.
    • d

      public static int d(@NonNull String tag, @NonNull String message, Object... arguments)
      Logs a debug message.
      Parameters:
      tag - the string that will ssed to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
      message - the message to be logged. The message may contain formatting token supported by String.format(String, Object...) method.
      arguments - an array of objects to be used for formatting the log message.
      Returns:
      The number of bytes written.
    • d

      public static int d(@NonNull String tag, @NonNull String message, Throwable error, Object... arguments)
      Logs a debug message.
      Parameters:
      tag - the string that will ssed to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
      message - the message to be logged. The message may contain formatting token supported by String.format(String, Object...) method.
      error - the error to be logged, if any.
      arguments - an array of objects to be used for formatting the log message.
      Returns:
      The number of bytes written.
    • i

      public static int i(@NonNull String tag, @NonNull String message, Object... arguments)
      Logs an information message.
      Parameters:
      tag - the string that will ssed to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
      message - the message to be logged. The message may contain formatting token supported by String.format(String, Object...) method.
      arguments - an array of objects to be used for formatting the log message.
      Returns:
      The number of bytes written.
    • i

      public static int i(@NonNull String tag, @NonNull String message, Throwable error, Object... arguments)
      Logs an information message.
      Parameters:
      tag - the string that will ssed to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
      message - the message to be logged. The message may contain formatting token supported by String.format(String, Object...) method.
      error - the error to be logged, if any.
      arguments - an array of objects to be used for formatting the log message.
      Returns:
      The number of bytes written.
    • w

      public static int w(@NonNull String tag, @NonNull String message, Object... arguments)
      Logs a warning message.
      Parameters:
      tag - the string that will ssed to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
      message - the message to be logged. The message may contain formatting token supported by String.format(String, Object...) method.
      arguments - an array of objects to be used for formatting the log message.
      Returns:
      The number of bytes written.
    • w

      public static int w(@NonNull String tag, @NonNull String message, Throwable error, Object... arguments)
      Logs a warning message.
      Parameters:
      tag - the string that will ssed to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
      message - the message to be logged. The message may contain formatting token supported by String.format(String, Object...) method.
      error - the error to be logged, if any.
      arguments - an array of objects to be used for formatting the log message.
      Returns:
      The number of bytes written.
    • e

      public static int e(@NonNull String tag, @NonNull String message, Object... arguments)
      Logs an error message.
      Parameters:
      tag - the string that will ssed to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
      message - the message to be logged. The message may contain formatting token supported by String.format(String, Object...) method.
      arguments - an array of objects to be used for formatting the log message.
      Returns:
      The number of bytes written.
    • e

      public static int e(@NonNull String tag, @NonNull String message, Throwable error, Object... arguments)
      Logs an error message.
      Parameters:
      tag - the string that will ssed to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
      message - the message to be logged. The message may contain formatting token supported by String.format(String, Object...) method.
      error - the error to be logged, if any.
      arguments - an array of objects to be used for formatting the log message.
      Returns:
      The number of bytes written.