Log
@UnstableApi
class Log
Wrapper around android.util.Log which allows to set the log level and to specify a custom log output.
Summary
Nested types |
|---|
@DocumentedLog level for ExoPlayer logcat logging. |
interface Log.LoggerInterface for a logger that can output messages with a tag. |
Constants |
|
|---|---|
const Int |
LOG_LEVEL_ALL = 0Log level to log all messages. |
const Int |
LOG_LEVEL_ERROR = 3Log level to only log error messages. |
const Int |
LOG_LEVEL_INFO = 1Log level to only log informative, warning and error messages. |
const Int |
LOG_LEVEL_OFF = 2147483647Log level to disable all logging. |
const Int |
Log level to only log warning and error messages. |
Public functions |
|
|---|---|
java-static String! |
@PureAppends the result of |
java-static Unit |
Logs a debug-level message. |
java-static Unit |
Logs a debug-level message with an optional associated |
java-static Unit |
Logs an error-level message. |
java-static Unit |
Logs an error-level message with an optional associated |
java-static String? |
@PureReturns a string representation of a |
java-static Unit |
Logs an information-level message. |
java-static Unit |
Logs an information-level message with an optional associated |
java-static Unit |
setLogStackTraces(logStackTraces: Boolean)Sets whether stack traces of |
java-static Unit |
setLogger(logger: Log.Logger!)Sets a custom |
java-static Unit |
Logs a warning-level message. |
java-static Unit |
Logs a warning-level message with an optional associated |
Constants
LOG_LEVEL_INFO
const val LOG_LEVEL_INFO = 1: Int
Log level to only log informative, warning and error messages.
LOG_LEVEL_WARNING
const val LOG_LEVEL_WARNING = 2: Int
Log level to only log warning and error messages.
Public functions
appendThrowableString
@Pure
java-static fun appendThrowableString(message: String!, throwable: Throwable?): String!
Appends the result of getThrowableString (if non-empty) to message.
d
@Pure
java-static fun d(tag: @Size(max = 23) String!, message: String!): Unit
Logs a debug-level message.
d
@Pure
java-static fun d(tag: @Size(max = 23) String!, message: String!, throwable: Throwable?): Unit
Logs a debug-level message with an optional associated Throwable.
e
@Pure
java-static fun e(tag: @Size(max = 23) String!, message: String!): Unit
Logs an error-level message.
e
@Pure
java-static fun e(tag: @Size(max = 23) String!, message: String!, throwable: Throwable?): Unit
Logs an error-level message with an optional associated Throwable.
getThrowableString
@Pure
java-static fun getThrowableString(throwable: Throwable?): String?
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.
i
@Pure
java-static fun i(tag: @Size(max = 23) String!, message: String!): Unit
Logs an information-level message.
i
@Pure
java-static fun i(tag: @Size(max = 23) String!, message: String!, throwable: Throwable?): Unit
Logs an information-level message with an optional associated Throwable.
setLogStackTraces
java-static fun setLogStackTraces(logStackTraces: Boolean): Unit
Sets whether stack traces of Throwables will be logged to logcat. Stack trace logging is enabled by default.
| Parameters | |
|---|---|
logStackTraces: Boolean |
Whether stack traces will be logged. |
setLogger
java-static fun setLogger(logger: Log.Logger!): Unit
Sets a custom Logger as the output.
| Parameters | |
|---|---|
logger: Log.Logger! |
The |
w
@Pure
java-static fun w(tag: @Size(max = 23) String!, message: String!): Unit
Logs a warning-level message.