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 void
add(RealmLogger logger)
Adds a logger implementation that will be notified on log events.static void
clear()
Removes all loggers.static void
debug(String message, Object... args)
Logs aLogLevel.DEBUG
event.static void
debug(Throwable throwable)
Logs aLogLevel.DEBUG
exception.static void
debug(Throwable throwable, String message, Object... args)
Logs aLogLevel.DEBUG
event.static void
error(String message, Object... args)
Logs anLogLevel.ERROR
event.static void
error(Throwable throwable)
Logs anLogLevel.ERROR
exception.static void
error(Throwable throwable, String message, Object... args)
Logs anLogLevel.ERROR
event.static void
fatal(String message, Object... args)
Logs anLogLevel.FATAL
event.static void
fatal(Throwable throwable)
Logs aLogLevel.FATAL
exception.static void
fatal(Throwable throwable, String message, Object... args)
Logs aLogLevel.FATAL
event.static int
getLevel()
Get the currentLogLevel
.static void
info(String message, Object... args)
Logs anLogLevel.INFO
event.static void
info(Throwable throwable)
Logs anLogLevel.INFO
exception.static void
info(Throwable throwable, String message, Object... args)
Logs anLogLevel.INFO
event.static void
registerDefaultLogger()
Adds default native logger if it has been removed before.static boolean
remove(RealmLogger logger)
Removes the given logger if it is currently added.static void
setLevel(int level)
Sets the currentLogLevel
.static void
trace(String message, Object... args)
Logs aLogLevel.TRACE
event.static void
trace(Throwable throwable)
Logs aLogLevel.TRACE
exception.static void
trace(Throwable throwable, String message, Object... args)
Logs aLogLevel.TRACE
event.static void
warn(String message, Object... args)
Logs aLogLevel.WARN
event.static void
warn(Throwable throwable)
Logs aLogLevel.WARN
exception.static void
warn(Throwable throwable, String message, Object... args)
Logs aLogLevel.WARN
event.
-
-
-
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 aRealmLogger
implementation.
-
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:
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. 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.TRACE
exception.- Parameters:
throwable
- exception to log.
-
trace
public static void trace(String message, Object... args)
Logs aLogLevel.TRACE
event.- 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.TRACE
event.- 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.DEBUG
exception.- Parameters:
throwable
- exception to log.
-
debug
public static void debug(String message, Object... args)
Logs aLogLevel.DEBUG
event.- 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.DEBUG
event.- 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.INFO
exception.- Parameters:
throwable
- exception to log.
-
info
public static void info(String message, Object... args)
Logs anLogLevel.INFO
event.- 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.INFO
event.- 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.WARN
exception.- Parameters:
throwable
- exception to log.
-
warn
public static void warn(String message, Object... args)
Logs aLogLevel.WARN
event.- 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.WARN
event.- 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.ERROR
exception.- Parameters:
throwable
- exception to log.
-
error
public static void error(String message, Object... args)
Logs anLogLevel.ERROR
event.- 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.ERROR
event.- 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.FATAL
exception.- Parameters:
throwable
- exception to log.
-
fatal
public static void fatal(String message, Object... args)
Logs anLogLevel.FATAL
event.- 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.FATAL
event.- Parameters:
throwable
- optional exception to log.message
- optional message.args
- optional args used to format the message usingString.format(String, Object...)
.
-
-