-
public class Log
A simple wrapper for android.util.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 public @interface
Log.Level
The list of possible of logging levels.
-
Method Summary
Modifier and Type Method Description 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. static int
v(@NonNull() String tag, @NonNull() String message, Array<Object> arguments)
Logs a verbose message. static int
v(@NonNull() String tag, @NonNull() String message, Throwable error, Array<Object> arguments)
Logs a verbose message. static int
d(@NonNull() String tag, @NonNull() String message, Array<Object> arguments)
Logs a debug message. static int
d(@NonNull() String tag, @NonNull() String message, Throwable error, Array<Object> arguments)
Logs a debug message. static int
i(@NonNull() String tag, @NonNull() String message, Array<Object> arguments)
Logs an information message. static int
i(@NonNull() String tag, @NonNull() String message, Throwable error, Array<Object> arguments)
Logs an information message. static int
w(@NonNull() String tag, @NonNull() String message, Array<Object> arguments)
Logs a warning message. static int
w(@NonNull() String tag, @NonNull() String message, Throwable error, Array<Object> arguments)
Logs a warning message. static int
e(@NonNull() String tag, @NonNull() String message, Array<Object> arguments)
Logs an error message. static int
e(@NonNull() String tag, @NonNull() String message, Throwable error, Array<Object> arguments)
Logs an error message. -
-
Method Detail
-
isLoggable
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 includingINFO will be logged. Before you make any calls to a logging method you should check to see ifyour tag should be logged. You can change the default level by setting a system property:'setprop log.tag.
- Parameters:
tag
- The tag to check.level
- The level to check.
-
v
static int v(@NonNull() String tag, @NonNull() String message, Array<Object> arguments)
Logs a verbose message.
- Parameters:
tag
- the string that will ssed to identify the source of a log message.message
- the message to be logged.arguments
- an array of objects to be used for formatting the log message.
-
v
static int v(@NonNull() String tag, @NonNull() String message, Throwable error, Array<Object> arguments)
Logs a verbose message.
- Parameters:
tag
- the string that will ssed to identify the source of a log message.message
- the message to be logged.error
- the error to be logged, if any.arguments
- an array of objects to be used for formatting the log message.
-
d
static int d(@NonNull() String tag, @NonNull() String message, Array<Object> arguments)
Logs a debug message.
- Parameters:
tag
- the string that will ssed to identify the source of a log message.message
- the message to be logged.arguments
- an array of objects to be used for formatting the log message.
-
d
static int d(@NonNull() String tag, @NonNull() String message, Throwable error, Array<Object> arguments)
Logs a debug message.
- Parameters:
tag
- the string that will ssed to identify the source of a log message.message
- the message to be logged.error
- the error to be logged, if any.arguments
- an array of objects to be used for formatting the log message.
-
i
static int i(@NonNull() String tag, @NonNull() String message, Array<Object> arguments)
Logs an information message.
- Parameters:
tag
- the string that will ssed to identify the source of a log message.message
- the message to be logged.arguments
- an array of objects to be used for formatting the log message.
-
i
static int i(@NonNull() String tag, @NonNull() String message, Throwable error, Array<Object> arguments)
Logs an information message.
- Parameters:
tag
- the string that will ssed to identify the source of a log message.message
- the message to be logged.error
- the error to be logged, if any.arguments
- an array of objects to be used for formatting the log message.
-
w
static int w(@NonNull() String tag, @NonNull() String message, Array<Object> arguments)
Logs a warning message.
- Parameters:
tag
- the string that will ssed to identify the source of a log message.message
- the message to be logged.arguments
- an array of objects to be used for formatting the log message.
-
w
static int w(@NonNull() String tag, @NonNull() String message, Throwable error, Array<Object> arguments)
Logs a warning message.
- Parameters:
tag
- the string that will ssed to identify the source of a log message.message
- the message to be logged.error
- the error to be logged, if any.arguments
- an array of objects to be used for formatting the log message.
-
e
static int e(@NonNull() String tag, @NonNull() String message, Array<Object> arguments)
Logs an error message.
- Parameters:
tag
- the string that will ssed to identify the source of a log message.message
- the message to be logged.arguments
- an array of objects to be used for formatting the log message.
-
e
static int e(@NonNull() String tag, @NonNull() String message, Throwable error, Array<Object> arguments)
Logs an error message.
- Parameters:
tag
- the string that will ssed to identify the source of a log message.message
- the message to be logged.error
- the error to be logged, if any.arguments
- an array of objects to be used for formatting the log message.
-
-
-
-