/** * Construct a builder, which will perform the same as the global one by default. */ public Builder() { XLog.assertInitialization(); }
/** * Log a message with level {@link LogLevel#VERBOSE}. * * @param format the format of the message to log * @param args the arguments of the message to log */ public static void v(String format, Object... args) { assertInitialization(); sLogger.v(format, args); }
/** * Log a message and a throwable with level {@link LogLevel#INFO}. * * @param msg the message to log * @param tr the throwable to be log */ public static void i(String msg, Throwable tr) { assertInitialization(); sLogger.i(msg, tr); }
/** * Log an array with level {@link LogLevel#ERROR}. * * @param array the array to log */ public static void e(Object[] array) { assertInitialization(); sLogger.e(array); }
/** * Log a JSON string, with level {@link LogLevel#DEBUG} by default. * * @param json the JSON string to log */ public static void json(String json) { assertInitialization(); sLogger.json(json); }
/** * Log a XML string, with level {@link LogLevel#DEBUG} by default. * * @param xml the XML string to log */ public static void xml(String xml) { assertInitialization(); sLogger.xml(xml); }
/** * Format a stack trace using default stack trace formatter. * * @param stackTrace the stack trace to format * @return the formatted string */ public static String formatStackTrace(StackTraceElement[] stackTrace) { assertInitialization(); return XLog.sLogConfiguration.stackTraceFormatter.format(stackTrace); }
/** * Add border to string segments using default border formatter. * * @param segments the string segments to add border to * @return the bordered string segments */ public static String addBorder(String[] segments) { assertInitialization(); return XLog.sLogConfiguration.borderFormatter.format(segments); }
/** * Log an object with level {@link LogLevel#VERBOSE}. * * @param object the object to log * @see LogConfiguration.Builder#addObjectFormatter(Class, ObjectFormatter) * @since 1.1.0 */ public static void v(Object object) { assertInitialization(); sLogger.v(object); }
/** * Log an object with level {@link LogLevel#DEBUG}. * * @param object the object to log * @see LogConfiguration.Builder#addObjectFormatter(Class, ObjectFormatter) * @since 1.1.0 */ public static void d(Object object) { assertInitialization(); sLogger.d(object); }
/** * Log an object with specific log level. * * @param logLevel the specific log level * @param object the object to log * @see LogConfiguration.Builder#addObjectFormatter(Class, ObjectFormatter) * @since 1.4.0 */ public static void log(int logLevel, Object object) { assertInitialization(); sLogger.log(logLevel, object); }
/** * Log a message with specific log level. * * @param logLevel the specific log level * @param format the format of the message to log * @param args the arguments of the message to log * @since 1.4.0 */ public static void log(int logLevel, String format, Object... args) { assertInitialization(); sLogger.log(logLevel, format, args); }
/** * Format a JSON string using default JSON formatter. * * @param json the JSON string to format * @return the formatted string */ public static String formatJson(String json) { assertInitialization(); return XLog.sLogConfiguration.jsonFormatter.format(json); }
/** * Log a message with level {@link LogLevel#DEBUG}. * * @param msg the message to log */ public static void d(String msg) { assertInitialization(); sLogger.d(msg); }
/** * Log a message with level {@link LogLevel#INFO}. * * @param msg the message to log */ public static void i(String msg) { assertInitialization(); sLogger.i(msg); }
/** * Log an array with level {@link LogLevel#WARN}. * * @param array the array to log */ public static void w(Object[] array) { assertInitialization(); sLogger.w(array); }
/** * Log a message with level {@link LogLevel#ERROR}. * * @param msg the message to log */ public static void e(String msg) { assertInitialization(); sLogger.e(msg); }
/** * Log a message and a throwable with level {@link LogLevel#ERROR}. * * @param msg the message to log * @param tr the throwable to be log */ public static void e(String msg, Throwable tr) { assertInitialization(); sLogger.e(msg, tr); }
/** * Log a message with specific log level. * * @param logLevel the specific log level * @param msg the message to log * @since 1.4.0 */ public static void log(int logLevel, String msg) { assertInitialization(); sLogger.log(logLevel, msg); }
/** * Format a thread using default thread formatter. * * @param thread the thread to format * @return the formatted string */ public static String formatThread(Thread thread) { assertInitialization(); return XLog.sLogConfiguration.threadFormatter.format(thread); }