/** * Performs single argument substitution for the 'messagePattern' passed as * parameter. * <p/> * For example, * <p/> * <pre> * MessageFormatter.format("Hi {}.", "there"); * </pre> * <p/> * will return the string "Hi there.". * <p/> * * @param messagePattern The message pattern which will be parsed and formatted * @param arg The argument to be substituted in place of the formatting anchor * @return The formatted message */ static FormattingTuple format(String messagePattern, Object arg) { return arrayFormat(messagePattern, new Object[]{arg}); }
sbuf.append(((Float) o).floatValue()); } else { safeObjectAppend(sbuf, o); safeObjectAppend(sbuf, o); booleanArrayAppend(sbuf, (boolean[]) o); } else if (objClass == byte[].class) { byteArrayAppend(sbuf, (byte[]) o); } else if (objClass == char[].class) { charArrayAppend(sbuf, (char[]) o); } else if (objClass == short[].class) { shortArrayAppend(sbuf, (short[]) o); } else if (objClass == int[].class) { intArrayAppend(sbuf, (int[]) o); } else if (objClass == long[].class) { longArrayAppend(sbuf, (long[]) o); } else if (objClass == float[].class) { floatArrayAppend(sbuf, (float[]) o); } else if (objClass == double[].class) { doubleArrayAppend(sbuf, (double[]) o); } else { objectArrayAppend(sbuf, (Object[]) o, seenSet);
private static void objectArrayAppend(StringBuilder sbuf, Object[] a, Set<Object[]> seenSet) { if (a.length == 0) { return; } if (seenSet == null) { seenSet = new HashSet<Object[]>(a.length); } if (seenSet.add(a)) { deeplyAppendParameter(sbuf, a[0], seenSet); for (int i = 1; i < a.length; i++) { sbuf.append(", "); deeplyAppendParameter(sbuf, a[i], seenSet); } // allow repeats in siblings seenSet.remove(a); } else { sbuf.append("..."); } }
/** * Log a message at level INFO according to the specified format and argument. * * <p> * This form avoids superfluous object creation when the logger is disabled * for the INFO level. * </p> * * @param format * the format string * @param arg * the argument */ @Override public void info(String format, Object arg) { if (logger.isInfoEnabled()) { FormattingTuple ft = MessageFormatter.format(format, arg); logger.log(FQCN, Level.INFO, ft.getMessage(), ft.getThrowable()); } }
/** * Delegates to the {@link Log#trace(Object)} method of the underlying * {@link Log} instance. * * <p> * However, this form avoids superfluous object creation when the logger is disabled * for level TRACE. * </p> * * @param format * the format string * @param arg * the argument */ @Override public void trace(String format, Object arg) { if (logger.isTraceEnabled()) { FormattingTuple ft = MessageFormatter.format(format, arg); logger.trace(ft.getMessage(), ft.getThrowable()); } }
sbuf.append(((Float) o).floatValue()); } else { safeObjectAppend(sbuf, o); safeObjectAppend(sbuf, o); booleanArrayAppend(sbuf, (boolean[]) o); } else if (objClass == byte[].class) { byteArrayAppend(sbuf, (byte[]) o); } else if (objClass == char[].class) { charArrayAppend(sbuf, (char[]) o); } else if (objClass == short[].class) { shortArrayAppend(sbuf, (short[]) o); } else if (objClass == int[].class) { intArrayAppend(sbuf, (int[]) o); } else if (objClass == long[].class) { longArrayAppend(sbuf, (long[]) o); } else if (objClass == float[].class) { floatArrayAppend(sbuf, (float[]) o); } else if (objClass == double[].class) { doubleArrayAppend(sbuf, (double[]) o); } else { objectArrayAppend(sbuf, (Object[]) o, seenSet);
/** * Performs a two argument substitution for the 'messagePattern' passed as * parameter. * <p/> * For example, * <p/> * <pre> * MessageFormatter.format("Hi {}. My name is {}.", "Alice", "Bob"); * </pre> * <p/> * will return the string "Hi Alice. My name is Bob.". * * @param messagePattern The message pattern which will be parsed and formatted * @param argA The argument to be substituted in place of the first formatting * anchor * @param argB The argument to be substituted in place of the second formatting * anchor * @return The formatted message */ static FormattingTuple format(final String messagePattern, Object argA, Object argB) { return arrayFormat(messagePattern, new Object[]{argA, argB}); }
/** * Log a message at level DEBUG according to the specified format and * argument. * * <p> * This form avoids superfluous object creation when the logger is disabled * for level DEBUG. * </p> * * @param format * the format string * @param arg * the argument */ @Override public void debug(String format, Object arg) { if (logger.isDebugEnabled()) { FormattingTuple ft = MessageFormatter.format(format, arg); logger.log(FQCN, Level.DEBUG, ft.getMessage(), ft.getThrowable()); } }
private static void objectArrayAppend(StringBuilder sbuf, Object[] a, Set<Object[]> seenSet) { if (a.length == 0) { return; } if (seenSet == null) { seenSet = new HashSet<Object[]>(a.length); } if (seenSet.add(a)) { deeplyAppendParameter(sbuf, a[0], seenSet); for (int i = 1; i < a.length; i++) { sbuf.append(", "); deeplyAppendParameter(sbuf, a[i], seenSet); } // allow repeats in siblings seenSet.remove(a); } else { sbuf.append("..."); } }
sbuf.append(((Float) o).floatValue()); } else { safeObjectAppend(sbuf, o); safeObjectAppend(sbuf, o); booleanArrayAppend(sbuf, (boolean[]) o); } else if (objClass == byte[].class) { byteArrayAppend(sbuf, (byte[]) o); } else if (objClass == char[].class) { charArrayAppend(sbuf, (char[]) o); } else if (objClass == short[].class) { shortArrayAppend(sbuf, (short[]) o); } else if (objClass == int[].class) { intArrayAppend(sbuf, (int[]) o); } else if (objClass == long[].class) { longArrayAppend(sbuf, (long[]) o); } else if (objClass == float[].class) { floatArrayAppend(sbuf, (float[]) o); } else if (objClass == double[].class) { doubleArrayAppend(sbuf, (double[]) o); } else { objectArrayAppend(sbuf, (Object[]) o, seenSet);
/** * Performs single argument substitution for the 'messagePattern' passed as * parameter. * <p/> * For example, * <p/> * <pre> * MessageFormatter.format("Hi {}.", "there"); * </pre> * <p/> * will return the string "Hi there.". * <p/> * * @param messagePattern The message pattern which will be parsed and formatted * @param arg The argument to be substituted in place of the formatting anchor * @return The formatted message */ static FormattingTuple format(String messagePattern, Object arg) { return arrayFormat(messagePattern, new Object[]{arg}); }
/** * Delegates to the {@link Log#error(Object)} method of the underlying * {@link Log} instance. * * <p> * However, this form avoids superfluous object creation when the logger is disabled * for level ERROR. * </p> * * @param format * the format string * @param arg * the argument */ @Override public void error(String format, Object arg) { if (logger.isErrorEnabled()) { FormattingTuple ft = MessageFormatter.format(format, arg); logger.error(ft.getMessage(), ft.getThrowable()); } }
private static void objectArrayAppend(StringBuilder sbuf, Object[] a, Set<Object[]> seenSet) { if (a.length == 0) { return; } if (seenSet == null) { seenSet = new HashSet<Object[]>(a.length); } if (seenSet.add(a)) { deeplyAppendParameter(sbuf, a[0], seenSet); for (int i = 1; i < a.length; i++) { sbuf.append(", "); deeplyAppendParameter(sbuf, a[i], seenSet); } // allow repeats in siblings seenSet.remove(a); } else { sbuf.append("..."); } }
sbuf.append(((Float) o).floatValue()); } else { safeObjectAppend(sbuf, o); safeObjectAppend(sbuf, o); booleanArrayAppend(sbuf, (boolean[]) o); } else if (objClass == byte[].class) { byteArrayAppend(sbuf, (byte[]) o); } else if (objClass == char[].class) { charArrayAppend(sbuf, (char[]) o); } else if (objClass == short[].class) { shortArrayAppend(sbuf, (short[]) o); } else if (objClass == int[].class) { intArrayAppend(sbuf, (int[]) o); } else if (objClass == long[].class) { longArrayAppend(sbuf, (long[]) o); } else if (objClass == float[].class) { floatArrayAppend(sbuf, (float[]) o); } else if (objClass == double[].class) { doubleArrayAppend(sbuf, (double[]) o); } else { objectArrayAppend(sbuf, (Object[]) o, seenSet);
/** * Performs a two argument substitution for the 'messagePattern' passed as * parameter. * <p/> * For example, * <p/> * <pre> * MessageFormatter.format("Hi {}. My name is {}.", "Alice", "Bob"); * </pre> * <p/> * will return the string "Hi Alice. My name is Bob.". * * @param messagePattern The message pattern which will be parsed and formatted * @param argA The argument to be substituted in place of the first formatting * anchor * @param argB The argument to be substituted in place of the second formatting * anchor * @return The formatted message */ static FormattingTuple format(final String messagePattern, Object argA, Object argB) { return arrayFormat(messagePattern, new Object[]{argA, argB}); }
/** * Delegates to the {@link Log#debug(Object)} method of the underlying * {@link Log} instance. * * <p> * However, this form avoids superfluous object creation when the logger is disabled * for level DEBUG. * </p> * * @param format * the format string * @param arg * the argument */ @Override public void debug(String format, Object arg) { if (logger.isDebugEnabled()) { FormattingTuple ft = MessageFormatter.format(format, arg); logger.debug(ft.getMessage(), ft.getThrowable()); } }
deeplyAppendParameter(sbuf, argArray[L], null); L++; if (L > lastArrIdx) {
sbuf.append(((Float) o).floatValue()); } else { safeObjectAppend(sbuf, o); safeObjectAppend(sbuf, o); booleanArrayAppend(sbuf, (boolean[]) o); } else if (objClass == byte[].class) { byteArrayAppend(sbuf, (byte[]) o); } else if (objClass == char[].class) { charArrayAppend(sbuf, (char[]) o); } else if (objClass == short[].class) { shortArrayAppend(sbuf, (short[]) o); } else if (objClass == int[].class) { intArrayAppend(sbuf, (int[]) o); } else if (objClass == long[].class) { longArrayAppend(sbuf, (long[]) o); } else if (objClass == float[].class) { floatArrayAppend(sbuf, (float[]) o); } else if (objClass == double[].class) { doubleArrayAppend(sbuf, (double[]) o); } else { objectArrayAppend(sbuf, (Object[]) o, seenSet);
/** * Delegates to the {@link Log#debug(Object)} method of the underlying * {@link Log} instance. * * <p> * However, this form avoids superfluous object creation when the logger is disabled * for level DEBUG. * </p> * * @param format the format string * @param arguments a list of 3 or more arguments */ @Override public void debug(String format, Object... arguments) { if (logger.isDebugEnabled()) { FormattingTuple ft = MessageFormatter.arrayFormat(format, arguments); logger.debug(ft.getMessage(), ft.getThrowable()); } }
/** * Delegates to the {@link Log#warn(Object)} method of the underlying * {@link Log} instance. * * <p> * However, this form avoids superfluous object creation when the logger is disabled * for level WARN. * </p> * * @param format * the format string * @param arg * the argument */ @Override public void warn(String format, Object arg) { if (logger.isWarnEnabled()) { FormattingTuple ft = MessageFormatter.format(format, arg); logger.warn(ft.getMessage(), ft.getThrowable()); } }