Class ShadowLog


  • @Implements(android.util.Log.class)
    public class ShadowLog
    extends java.lang.Object
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  ShadowLog.LogItem  
      static class  ShadowLog.TerribleFailure
      Failure thrown when wtf_is_fatal is true and Log.wtf is called.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.io.PrintStream stream  
    • Constructor Summary

      Constructors 
      Constructor Description
      ShadowLog()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void clear()
      Clear all accumulated logs.
      protected static int d​(java.lang.String tag, java.lang.String msg)  
      protected static int d​(java.lang.String tag, java.lang.String msg, java.lang.Throwable throwable)  
      protected static int e​(java.lang.String tag, java.lang.String msg)  
      protected static int e​(java.lang.String tag, java.lang.String msg, java.lang.Throwable throwable)  
      static java.util.List<ShadowLog.LogItem> getLogs()
      Returns ordered list of all log entries.
      static java.util.List<ShadowLog.LogItem> getLogsForTag​(java.lang.String tag)
      Returns ordered list of all log items for a specific tag.
      protected static int i​(java.lang.String tag, java.lang.String msg)  
      protected static int i​(java.lang.String tag, java.lang.String msg, java.lang.Throwable throwable)  
      protected static boolean isLoggable​(java.lang.String tag, int level)  
      protected static char levelToChar​(int level)  
      protected static int println_native​(int bufID, int priority, java.lang.String tag, java.lang.String msg)  
      static void reset()  
      static void setLoggable​(java.lang.String tag, int level)
      Sets the log level of a given tag, that isLoggable(java.lang.String, int) will follow.
      static void setTimeSupplier​(java.util.function.Supplier<java.lang.String> supplier)
      Sets supplier that can be used to get time to add to logs.
      static void setupLogging()  
      static void setWtfIsFatal​(boolean fatal)
      Sets whether calling Log.wtf(java.lang.String, java.lang.String) will throw ShadowLog.TerribleFailure.
      protected static int v​(java.lang.String tag, java.lang.String msg)  
      protected static int v​(java.lang.String tag, java.lang.String msg, java.lang.Throwable throwable)  
      protected static int w​(java.lang.String tag, java.lang.String msg)  
      protected static int w​(java.lang.String tag, java.lang.String msg, java.lang.Throwable throwable)  
      protected static int w​(java.lang.String tag, java.lang.Throwable throwable)  
      protected static int wtf​(java.lang.String tag, java.lang.String msg)  
      protected static int wtf​(java.lang.String tag, java.lang.String msg, java.lang.Throwable throwable)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • stream

        public static java.io.PrintStream stream
    • Constructor Detail

      • ShadowLog

        public ShadowLog()
    • Method Detail

      • e

        @Implementation
        protected static int e​(java.lang.String tag,
                               java.lang.String msg)
      • e

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

        @Implementation
        protected static int d​(java.lang.String tag,
                               java.lang.String msg)
      • d

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

        @Implementation
        protected static int i​(java.lang.String tag,
                               java.lang.String msg)
      • i

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

        @Implementation
        protected static int v​(java.lang.String tag,
                               java.lang.String msg)
      • v

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

        @Implementation
        protected static int w​(java.lang.String tag,
                               java.lang.String msg)
      • w

        @Implementation
        protected static int w​(java.lang.String tag,
                               java.lang.Throwable throwable)
      • w

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

        @Implementation
        protected static int wtf​(java.lang.String tag,
                                 java.lang.String msg)
      • wtf

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

        public static void setWtfIsFatal​(boolean fatal)
        Sets whether calling Log.wtf(java.lang.String, java.lang.String) will throw ShadowLog.TerribleFailure.
      • setTimeSupplier

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

        @Implementation
        protected static boolean isLoggable​(java.lang.String tag,
                                            int level)
      • println_native

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

        public static void setLoggable​(java.lang.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 java.util.List<ShadowLog.LogItem> getLogs()
        Returns ordered list of all log entries.
        Returns:
        List of log items
      • getLogsForTag

        public static java.util.List<ShadowLog.LogItem> getLogsForTag​(java.lang.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()