private void logChunk(int priority, @Nullable String tag, @NonNull String chunk) { checkNotNull(chunk); logStrategy.log(priority, tag, chunk); }
@Override public void log(int priority, @Nullable String onceOnlyTag, @NonNull String message) { checkNotNull(message); String tag = formatTag(onceOnlyTag); date.setTime(System.currentTimeMillis()); StringBuilder builder = new StringBuilder(); // machine-readable date/time builder.append(Long.toString(date.getTime())); // human-readable date/time builder.append(SEPARATOR); builder.append(dateFormat.format(date)); // level builder.append(SEPARATOR); builder.append(Utils.logLevel(priority)); // tag builder.append(SEPARATOR); builder.append(tag); // message if (message.contains(NEW_LINE)) { // a new line would break the CSV format, so we replace it here message = message.replaceAll(NEW_LINE, NEW_LINE_REPLACEMENT); } builder.append(SEPARATOR); builder.append(message); // new line builder.append(NEW_LINE); logStrategy.log(priority, tag, builder.toString()); }