Package io.realm.log

Class RealmLog


  • public final class RealmLog
    extends Object
    Global logger used by all Realm components. Custom loggers can be added by registering classes implementing RealmLogger.
    • Constructor Detail

      • RealmLog

        public RealmLog()
    • Method Detail

      • add

        public static void add​(RealmLogger logger)
        Adds a logger implementation that will be notified on log events.
        Parameters:
        logger - the reference to a RealmLogger implementation.
      • setLevel

        public static void setLevel​(int level)
        Sets the current LogLevel. Setting this will affect all registered loggers.
        Parameters:
        level - see LogLevel.
      • getLevel

        public static int getLevel()
        Get the current LogLevel.
        Returns:
        the current LogLevel.
      • remove

        public static boolean remove​(RealmLogger logger)
        Removes the given logger if it is currently added.
        Returns:
        true if the logger was removed, false otherwise.
      • clear

        public static void clear()
        Removes all loggers. The default native logger will be removed as well. Use registerDefaultLogger() to add it back.
      • registerDefaultLogger

        public static void registerDefaultLogger()
        Adds default native logger if it has been removed before. If the default logger has been registered already, it won't be added again. The default logger on Android will log to logcat.
      • trace

        public static void trace​(Throwable throwable)
        Logs a LogLevel.TRACE exception.
        Parameters:
        throwable - exception to log.
      • debug

        public static void debug​(@Nullable
                                 Throwable throwable)
        Logs a LogLevel.DEBUG exception.
        Parameters:
        throwable - exception to log.
      • info

        public static void info​(Throwable throwable)
        Logs an LogLevel.INFO exception.
        Parameters:
        throwable - exception to log.
      • warn

        public static void warn​(Throwable throwable)
        Logs a LogLevel.WARN exception.
        Parameters:
        throwable - exception to log.
      • error

        public static void error​(Throwable throwable)
        Logs an LogLevel.ERROR exception.
        Parameters:
        throwable - exception to log.
      • fatal

        public static void fatal​(Throwable throwable)
        Logs a LogLevel.FATAL exception.
        Parameters:
        throwable - exception to log.