Package org.robolectric.shadows
Class ShadowLog
java.lang.Object
org.robolectric.shadows.ShadowLog
Controls the behavior of
Log
and provides access to log messages.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
A single log item.static final class
Failure thrown when wtf_is_fatal is true and Log.wtf is called. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
clear()
Clear all accumulated logs.protected static int
protected static int
protected static int
protected static int
static com.google.common.collect.ImmutableList<ShadowLog.LogItem>
getLogs()
Returns ordered list of all log entries.static com.google.common.collect.ImmutableList<ShadowLog.LogItem>
getLogsForTag
(String tag) Returns ordered list of all log items for a specific tag.protected static int
protected static int
protected static boolean
isLoggable
(String tag, int level) protected static char
levelToChar
(int level) protected static int
println_native
(int bufID, int priority, String tag, String msg) static void
reset()
static void
setLoggable
(String tag, int level) Sets the log level of a given tag, thatisLoggable(java.lang.String, int)
will follow.static void
setTimeSupplier
(Supplier<String> supplier) Sets supplier that can be used to get time to add to logs.static void
static void
setWtfIsFatal
(boolean fatal) Sets whether callingLog.wtf(java.lang.String, java.lang.String)
will throwShadowLog.TerribleFailure
.protected static int
protected static int
protected static int
protected static int
protected static int
protected static int
protected static int
-
Field Details
-
stream
-
-
Constructor Details
-
ShadowLog
public ShadowLog()
-
-
Method Details
-
e
-
e
-
d
-
d
-
i
-
i
-
v
-
v
-
w
-
w
-
w
-
wtf
-
wtf
-
setWtfIsFatal
public static void setWtfIsFatal(boolean fatal) Sets whether callingLog.wtf(java.lang.String, java.lang.String)
will throwShadowLog.TerribleFailure
. -
setTimeSupplier
Sets supplier that can be used to get time to add to logs. -
isLoggable
-
println_native
@Implementation protected static int println_native(int bufID, int priority, String tag, String msg) -
setLoggable
Sets the log level of a given tag, thatisLoggable(java.lang.String, int)
will follow.- Parameters:
tag
- A log taglevel
- A log level, fromLog
-
levelToChar
protected static char levelToChar(int level) -
getLogs
Returns ordered list of all log entries.- Returns:
- List of log items
-
getLogsForTag
Returns ordered list of all log items for a specific tag.- Parameters:
tag
- The tag to get logs for- Returns:
- The list of log items for the tag or an empty list if no logs for that tag exist.
-
clear
public static void clear()Clear all accumulated logs. -
reset
-
setupLogging
public static void setupLogging()
-