Package io.realm.log
Class RealmLog
- java.lang.Object
-
- io.realm.log.RealmLog
-
public final class RealmLog extends Object
Global logger used by all Realm components. Custom loggers can be added by registering classes implementingRealmLogger.
-
-
Constructor Summary
Constructors Constructor Description RealmLog()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidadd(RealmLogger logger)Adds a logger implementation that will be notified on log events.static voidclear()Removes all loggers.static voiddebug(String message, Object... args)Logs aLogLevel.DEBUGevent.static voiddebug(Throwable throwable)Logs aLogLevel.DEBUGexception.static voiddebug(Throwable throwable, String message, Object... args)Logs aLogLevel.DEBUGevent.static voiderror(String message, Object... args)Logs anLogLevel.ERRORevent.static voiderror(Throwable throwable)Logs anLogLevel.ERRORexception.static voiderror(Throwable throwable, String message, Object... args)Logs anLogLevel.ERRORevent.static voidfatal(String message, Object... args)Logs anLogLevel.FATALevent.static voidfatal(Throwable throwable)Logs aLogLevel.FATALexception.static voidfatal(Throwable throwable, String message, Object... args)Logs aLogLevel.FATALevent.static intgetLevel()Get the currentLogLevel.static voidinfo(String message, Object... args)Logs anLogLevel.INFOevent.static voidinfo(Throwable throwable)Logs anLogLevel.INFOexception.static voidinfo(Throwable throwable, String message, Object... args)Logs anLogLevel.INFOevent.static voidregisterDefaultLogger()Adds default native logger if it has been removed before.static booleanremove(RealmLogger logger)Removes the given logger if it is currently added.static voidsetLevel(int level)Sets the currentLogLevel.static voidtrace(String message, Object... args)Logs aLogLevel.TRACEevent.static voidtrace(Throwable throwable)Logs aLogLevel.TRACEexception.static voidtrace(Throwable throwable, String message, Object... args)Logs aLogLevel.TRACEevent.static voidwarn(String message, Object... args)Logs aLogLevel.WARNevent.static voidwarn(Throwable throwable)Logs aLogLevel.WARNexception.static voidwarn(Throwable throwable, String message, Object... args)Logs aLogLevel.WARNevent.
-
-
-
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 aRealmLoggerimplementation.
-
setLevel
public static void setLevel(int level)
Sets the currentLogLevel. Setting this will affect all registered loggers.- Parameters:
level- seeLogLevel.
-
remove
public static boolean remove(RealmLogger logger)
Removes the given logger if it is currently added.- Returns:
trueif the logger was removed,falseotherwise.
-
clear
public static void clear()
Removes all loggers. The default native logger will be removed as well. UseregisterDefaultLogger()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 aLogLevel.TRACEexception.- Parameters:
throwable- exception to log.
-
trace
public static void trace(String message, Object... args)
Logs aLogLevel.TRACEevent.- Parameters:
message- message to log.args- optional args used to format the message usingString.format(String, Object...).
-
trace
public static void trace(@Nullable Throwable throwable, @Nullable String message, Object... args)
Logs aLogLevel.TRACEevent.- Parameters:
throwable- optional exception to log.message- optional message.args- optional args used to format the message usingString.format(String, Object...).
-
debug
public static void debug(@Nullable Throwable throwable)
Logs aLogLevel.DEBUGexception.- Parameters:
throwable- exception to log.
-
debug
public static void debug(String message, Object... args)
Logs aLogLevel.DEBUGevent.- Parameters:
message- message to log.args- optional args used to format the message usingString.format(String, Object...).
-
debug
public static void debug(@Nullable Throwable throwable, @Nullable String message, Object... args)
Logs aLogLevel.DEBUGevent.- Parameters:
throwable- optional exception to log.message- optional message.args- optional args used to format the message usingString.format(String, Object...).
-
info
public static void info(Throwable throwable)
Logs anLogLevel.INFOexception.- Parameters:
throwable- exception to log.
-
info
public static void info(String message, Object... args)
Logs anLogLevel.INFOevent.- Parameters:
message- message to log.args- optional args used to format the message usingString.format(String, Object...).
-
info
public static void info(@Nullable Throwable throwable, @Nullable String message, Object... args)
Logs anLogLevel.INFOevent.- Parameters:
throwable- optional exception to log.message- optional message.args- optional args used to format the message usingString.format(String, Object...).
-
warn
public static void warn(Throwable throwable)
Logs aLogLevel.WARNexception.- Parameters:
throwable- exception to log.
-
warn
public static void warn(String message, Object... args)
Logs aLogLevel.WARNevent.- Parameters:
message- message to log.args- optional args used to format the message usingString.format(String, Object...).
-
warn
public static void warn(@Nullable Throwable throwable, @Nullable String message, Object... args)
Logs aLogLevel.WARNevent.- Parameters:
throwable- optional exception to log.message- optional message.args- optional args used to format the message usingString.format(String, Object...).
-
error
public static void error(Throwable throwable)
Logs anLogLevel.ERRORexception.- Parameters:
throwable- exception to log.
-
error
public static void error(String message, Object... args)
Logs anLogLevel.ERRORevent.- Parameters:
message- message to log.args- optional args used to format the message usingString.format(String, Object...).
-
error
public static void error(@Nullable Throwable throwable, @Nullable String message, Object... args)
Logs anLogLevel.ERRORevent.- Parameters:
throwable- optional exception to log.message- optional message.args- optional args used to format the message usingString.format(String, Object...).
-
fatal
public static void fatal(Throwable throwable)
Logs aLogLevel.FATALexception.- Parameters:
throwable- exception to log.
-
fatal
public static void fatal(String message, Object... args)
Logs anLogLevel.FATALevent.- Parameters:
message- message to log.args- optional args used to format the message usingString.format(String, Object...).
-
fatal
public static void fatal(@Nullable Throwable throwable, @Nullable String message, Object... args)
Logs aLogLevel.FATALevent.- Parameters:
throwable- optional exception to log.message- optional message.args- optional args used to format the message usingString.format(String, Object...).
-
-