Class ShadowLog

java.lang.Object
org.robolectric.shadows.ShadowLog

@Implements(android.util.Log.class) public class ShadowLog extends Object
Controls the behavior of Log and provides access to log messages.
  • Field Details

  • Constructor Details

    • ShadowLog

      public ShadowLog()
  • Method Details

    • e

      @Implementation protected static int e(String tag, String msg)
    • e

      @Implementation protected static int e(String tag, String msg, Throwable throwable)
    • d

      @Implementation protected static int d(String tag, String msg)
    • d

      @Implementation protected static int d(String tag, String msg, Throwable throwable)
    • i

      @Implementation protected static int i(String tag, String msg)
    • i

      @Implementation protected static int i(String tag, String msg, Throwable throwable)
    • v

      @Implementation protected static int v(String tag, String msg)
    • v

      @Implementation protected static int v(String tag, String msg, Throwable throwable)
    • w

      @Implementation protected static int w(String tag, String msg)
    • w

      @Implementation protected static int w(String tag, Throwable throwable)
    • w

      @Implementation protected static int w(String tag, String msg, Throwable throwable)
    • wtf

      @Implementation protected static int wtf(String tag, String msg)
    • wtf

      @Implementation protected static int wtf(String tag, String msg, Throwable throwable)
    • setWtfIsFatal

      public static void setWtfIsFatal(boolean fatal)
    • setTimeSupplier

      public static void setTimeSupplier(Supplier<String> supplier)
      Sets supplier that can be used to get time to add to logs.
    • isLoggable

      @Implementation protected static boolean isLoggable(String tag, int level)
    • println_native

      @Implementation protected static int println_native(int bufID, int priority, String tag, String msg)
    • setLoggable

      public static void setLoggable(String tag, int level)
      Sets the log level of a given tag, that isLoggable(java.lang.String, int) will follow.
      Parameters:
      tag - A log tag
      level - A log level, from Log
    • levelToChar

      protected static char levelToChar(int level)
    • getLogs

      public static com.google.common.collect.ImmutableList<ShadowLog.LogItem> getLogs()
      Returns ordered list of all log entries.
      Returns:
      List of log items
    • getLogsForTag

      public static com.google.common.collect.ImmutableList<ShadowLog.LogItem> getLogsForTag(String tag)
      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

      @Resetter public static void reset()
    • setupLogging

      public static void setupLogging()