/** * Print a log in a new line. * * @param logLevel the log level of the printing log * @param msg the message you would like to log */ /*package*/ void println(int logLevel, String msg) { if (logLevel < logConfiguration.logLevel) { return; } printlnInternal(logLevel, msg); }
/** * Print an array in a new line. * * @param logLevel the log level of the printing array * @param array the array to print */ private void println(int logLevel, Object[] array) { if (logLevel < logConfiguration.logLevel) { return; } printlnInternal(logLevel, Arrays.deepToString(array)); }
/** * Log a XML string, with level {@link LogLevel#DEBUG} by default. * * @param xml the XML string to log */ public void xml(String xml) { if (LogLevel.DEBUG < logConfiguration.logLevel) { return; } printlnInternal(LogLevel.DEBUG, logConfiguration.xmlFormatter.format(xml)); }
/** * Log a JSON string, with level {@link LogLevel#DEBUG} by default. * * @param json the JSON string to log */ public void json(String json) { if (LogLevel.DEBUG < logConfiguration.logLevel) { return; } printlnInternal(LogLevel.DEBUG, logConfiguration.jsonFormatter.format(json)); }
/** * Print a log in a new line. * * @param logLevel the log level of the printing log * @param format the format of the printing log, null if just need to concat arguments * @param args the arguments of the printing log */ private void println(int logLevel, String format, Object... args) { if (logLevel < logConfiguration.logLevel) { return; } printlnInternal(logLevel, formatArgs(format, args)); }
/** * Print a log in a new line. * * @param logLevel the log level of the printing log * @param msg the message you would like to log * @param tr a throwable object to log */ private void println(int logLevel, String msg, Throwable tr) { if (logLevel < logConfiguration.logLevel) { return; } printlnInternal(logLevel, ((msg == null || msg.length() == 0) ? "" : (msg + SystemCompat.lineSeparator)) + logConfiguration.throwableFormatter.format(tr)); }
/** * Print an object in a new line. * * @param logLevel the log level of the printing object * @param object the object to print */ private <T> void println(int logLevel, T object) { if (logLevel < logConfiguration.logLevel) { return; } String objectString; if (object != null) { ObjectFormatter<? super T> objectFormatter = logConfiguration.getObjectFormatter(object); if (objectFormatter != null) { objectString = objectFormatter.format(object); } else { objectString = object.toString(); } } else { objectString = "null"; } printlnInternal(logLevel, objectString); }