Stay organized with collections Save and categorize content based on your preferences.

Log

@UnstableApi
public final class Log


Wrapper around android.util.Log which allows to set the log level and to specify a custom log output.

Summary

Nested types

@Documented
@Retention(value = RetentionPolicy.SOURCE)
@Target(value = TYPE_USE)
@IntDef(value = )
public annotation Log.LogLevel

Log level for ExoPlayer logcat logging.

public interface Log.Logger

Interface for a logger that can output messages with a tag.

Constants

static final int

Log level to log all messages.

static final int

Log level to only log error messages.

static final int

Log level to only log informative, warning and error messages.

static final int
LOG_LEVEL_OFF = 2147483647

Log level to disable all logging.

static final int

Log level to only log warning and error messages.

Public fields

static int
@GuardedBy(value = "lock")
logLevel

Public constructors

Log()

Public methods

static void
@Pure
d(@Size(max = 23) String tag, String message, @Nullable Throwable throwable)
static void
@Pure
d(@Size(max = 23) String tag, String message)
static void
@Pure
e(@Size(max = 23) String tag, String message, @Nullable Throwable throwable)
static void
@Pure
e(@Size(max = 23) String tag, String message)
static int

Returns current LogLevel for ExoPlayer logcat logging.

static @Nullable String

Returns a string representation of a Throwable suitable for logging, taking into account whether setLogStackTraces stack trace logging} is enabled.

static void
@Pure
i(@Size(max = 23) String tag, String message, @Nullable Throwable throwable)
static void
@Pure
i(@Size(max = 23) String tag, String message)
static void
setLogLevel(@Log.LogLevel int logLevel)

Sets the LogLevel for ExoPlayer logcat logging.

static void
setLogStackTraces(boolean logStackTraces)

Sets whether stack traces of Throwables will be logged to logcat.

static void

Sets a custom Logger as the output.

static void
@Pure
w(@Size(max = 23) String tag, String message, @Nullable Throwable throwable)
static void
@Pure
w(@Size(max = 23) String tag, String message)

Constants

LOG_LEVEL_ALL

public static final int LOG_LEVEL_ALL = 0

Log level to log all messages.

LOG_LEVEL_ERROR

public static final int LOG_LEVEL_ERROR = 3

Log level to only log error messages.

LOG_LEVEL_INFO

public static final int LOG_LEVEL_INFO = 1

Log level to only log informative, warning and error messages.

LOG_LEVEL_OFF

public static final int LOG_LEVEL_OFF = 2147483647

Log level to disable all logging.

LOG_LEVEL_WARNING

public static final int LOG_LEVEL_WARNING = 2

Log level to only log warning and error messages.

Public fields

logLevel

@GuardedBy(value = "lock")
public static int logLevel

Public constructors

Log

public Log()

Public methods

d

@Pure
public static void d(@Size(max = 23) String tag, String message, @Nullable Throwable throwable)
See also
d

d

@Pure
public static void d(@Size(max = 23) String tag, String message)
See also
d

e

@Pure
public static void e(@Size(max = 23) String tag, String message, @Nullable Throwable throwable)
See also
e

e

@Pure
public static void e(@Size(max = 23) String tag, String message)
See also
e

getLogLevel

@Pure
@Log.LogLevel
public static int getLogLevel()

Returns current LogLevel for ExoPlayer logcat logging.

getThrowableString

@Pure
public static @Nullable String getThrowableString(@Nullable Throwable throwable)

Returns a string representation of a Throwable suitable for logging, taking into account whether setLogStackTraces stack trace logging} is enabled.

Stack trace logging may be unconditionally suppressed for some expected failure modes (e.g., Throwables that are expected if the device doesn't have network connectivity) to avoid log spam.

Parameters
@Nullable Throwable throwable

The Throwable.

Returns
@Nullable String

The string representation of the Throwable.

i

@Pure
public static void i(@Size(max = 23) String tag, String message, @Nullable Throwable throwable)
See also
i

i

@Pure
public static void i(@Size(max = 23) String tag, String message)
See also
i

setLogLevel

public static void setLogLevel(@Log.LogLevel int logLevel)

Sets the LogLevel for ExoPlayer logcat logging.

Parameters
@Log.LogLevel int logLevel

The new LogLevel.

setLogStackTraces

public static void setLogStackTraces(boolean logStackTraces)

Sets whether stack traces of Throwables will be logged to logcat. Stack trace logging is enabled by default.

Parameters
boolean logStackTraces

Whether stack traces will be logged.

setLogger

public static void setLogger(Log.Logger logger)

Sets a custom Logger as the output.

Parameters
Log.Logger logger

The Logger.

w

@Pure
public static void w(@Size(max = 23) String tag, String message, @Nullable Throwable throwable)
See also
w

w

@Pure
public static void w(@Size(max = 23) String tag, String message)
See also
w