public final class L extends Object
L
class provides some methods whose tag
argument's type is Object
. The methods convert
the given tag
object into a String
instance by the steps shown below before calling
counterpart methods of android.util.Log
.
tag
implements CharSequence
,
call tag.toString()
.
tag
is an instance of Class<?>
,
call ((Class<?>)tag).getSimpleName()
.
tag.getClass().getSimpleName()
.
The conversion above allows programmers to write code snippets like below.
// 'this' can be used as tag. L.d(this, "'this' can be used as tag."); // A Class instance can be used as tag. L.d(MyClass.class, "A Class instance can be used as tag.");
L
class also provides ?(Object tag, String format, Object... args)
and ?(Object tag, Throwable cause, String format, Object... args)
methods.
They internally build a String
instance by calling
String.format(format, args)
before calling counterpart
methods of android.util.Log
. String concatenation by
+
is not needed any more before calling logging methods.
String firstName = ...; String lastName = ...; L.d(this, "Name = %s %s", firstName, lastName);
Modifier and Type | Method and Description |
---|---|
static int |
d(Object tag,
String message)
Emit a log message of DEBUG level.
|
static int |
d(Object tag,
String format,
Object... args)
Emit a log message of DEBUG level.
|
static int |
d(Object tag,
String message,
Throwable cause)
Emit a log message of DEBUG level.
|
static int |
d(Object tag,
Throwable cause,
String format,
Object... args)
Emit a log message of DEBUG level.
|
static int |
d(String tag,
String message)
Emit a log message of DEBUG level by calling
Log.d (tag, message) . |
static int |
d(String tag,
String message,
Throwable cause)
Emit a log message of DEBUG level by calling
Log.d (tag, message, cause) . |
static int |
dformat(Object tag,
String format,
Object... args)
Deprecated.
|
static int |
dformat(Object tag,
Throwable cause,
String format,
Object... args)
Deprecated.
|
static int |
e(Object tag,
String message)
Emit a log message of ERROR level.
|
static int |
e(Object tag,
String format,
Object... args)
Emit a log message of ERROR level.
|
static int |
e(Object tag,
String message,
Throwable cause)
Emit a log message of ERROR level.
|
static int |
e(Object tag,
Throwable cause,
String format,
Object... args)
Emit a log message of ERROR level.
|
static int |
e(String tag,
String message)
Emit a log message of ERROR level by calling
Log.e (tag, message) . |
static int |
e(String tag,
String message,
Throwable cause)
Emit a log message of ERROR level by calling
Log.e (tag, message, cause) . |
static int |
eformat(Object tag,
String format,
Object... args)
Deprecated.
|
static int |
eformat(Object tag,
Throwable cause,
String format,
Object... args)
Deprecated.
|
static int |
i(Object tag,
String message)
Emit a log message of INFO level.
|
static int |
i(Object tag,
String format,
Object... args)
Emit a log message of INFO level.
|
static int |
i(Object tag,
String message,
Throwable cause)
Emit a log message of INFO level.
|
static int |
i(Object tag,
Throwable cause,
String format,
Object... args)
Emit a log message of INFO level.
|
static int |
i(String tag,
String message)
Emit a log message of INFO level by calling
Log.i (tag, message) . |
static int |
i(String tag,
String message,
Throwable cause)
Emit a log message of INFO level by calling
Log.i (tag, message, cause) . |
static int |
iformat(Object tag,
String format,
Object... args)
Deprecated.
|
static int |
iformat(Object tag,
Throwable cause,
String format,
Object... args)
Deprecated.
|
static int |
v(Object tag,
String message)
Emit a log message of VERBOSE level.
|
static int |
v(Object tag,
String format,
Object... args)
Emit a log message of VERBOSE level.
|
static int |
v(Object tag,
String message,
Throwable cause)
Emit a log message of VERBOSE level.
|
static int |
v(Object tag,
Throwable cause,
String format,
Object... args)
Emit a log message of VERBOSE level.
|
static int |
v(String tag,
String message)
Emit a log message of VERBOSE level by calling
Log.v (tag, message) . |
static int |
v(String tag,
String message,
Throwable cause)
Emit a log message of VERBOSE level by calling
Log.v (tag, message, cause) . |
static int |
vformat(Object tag,
String format,
Object... args)
Deprecated.
|
static int |
vformat(Object tag,
Throwable cause,
String format,
Object... args)
Deprecated.
|
static int |
w(Object tag,
String message)
Emit a log message of WARN level.
|
static int |
w(Object tag,
String format,
Object... args)
Emit a log message of WARN level.
|
static int |
w(Object tag,
String message,
Throwable cause)
Emit a log message of WARN level.
|
static int |
w(Object tag,
Throwable cause,
String format,
Object... args)
Emit a log message of WARN level.
|
static int |
w(String tag,
String message)
Emit a log message of WARN level by calling
Log.w (tag, message) . |
static int |
w(String tag,
String message,
Throwable cause)
Emit a log message of WARN level by calling
Log.w (tag, message, cause) . |
static int |
wformat(Object tag,
String format,
Object... args)
Deprecated.
|
static int |
wformat(Object tag,
Throwable cause,
String format,
Object... args)
Deprecated.
|
public static int d(String tag, String message)
Log.d
(tag, message)
.public static int d(String tag, String message, Throwable cause)
Log.d
(tag, message, cause)
.public static int d(Object tag, String message, Throwable cause)
public static int d(Object tag, String format, Object... args)
public static int d(Object tag, Throwable cause, String format, Object... args)
@Deprecated public static int dformat(Object tag, String format, Object... args)
d(Object, String, Object...)
.@Deprecated public static int dformat(Object tag, Throwable cause, String format, Object... args)
d(Object, Throwable, String, Object...)
.public static int e(String tag, String message)
Log.e
(tag, message)
.public static int e(String tag, String message, Throwable cause)
Log.e
(tag, message, cause)
.public static int e(Object tag, String message, Throwable cause)
public static int e(Object tag, String format, Object... args)
public static int e(Object tag, Throwable cause, String format, Object... args)
@Deprecated public static int eformat(Object tag, String format, Object... args)
e(Object, String, Object...)
.@Deprecated public static int eformat(Object tag, Throwable cause, String format, Object... args)
e(Object, Throwable, String, Object...)
.public static int i(String tag, String message)
Log.i
(tag, message)
.public static int i(String tag, String message, Throwable cause)
Log.i
(tag, message, cause)
.public static int i(Object tag, String message, Throwable cause)
public static int i(Object tag, String format, Object... args)
public static int i(Object tag, Throwable cause, String format, Object... args)
@Deprecated public static int iformat(Object tag, String format, Object... args)
i(Object, String, Object...)
.@Deprecated public static int iformat(Object tag, Throwable cause, String format, Object... args)
i(Object, Throwable, String, Object...)
.public static int v(String tag, String message)
Log.v
(tag, message)
.public static int v(String tag, String message, Throwable cause)
Log.v
(tag, message, cause)
.public static int v(Object tag, String message, Throwable cause)
public static int v(Object tag, String format, Object... args)
public static int v(Object tag, Throwable cause, String format, Object... args)
@Deprecated public static int vformat(Object tag, String format, Object... args)
v(Object, String, Object...)
.@Deprecated public static int vformat(Object tag, Throwable cause, String format, Object... args)
v(Object, Throwable, String, Object...)
.public static int w(String tag, String message)
Log.w
(tag, message)
.public static int w(String tag, String message, Throwable cause)
Log.w
(tag, message, cause)
.public static int w(Object tag, String message, Throwable cause)
public static int w(Object tag, String format, Object... args)
public static int w(Object tag, Throwable cause, String format, Object... args)
@Deprecated public static int wformat(Object tag, String format, Object... args)
w(Object, String, Object...)
.@Deprecated public static int wformat(Object tag, Throwable cause, String format, Object... args)
w(Object, Throwable, String, Object...)
.Copyright © 2016. All rights reserved.