@VisibleForTesting public String getAndClearBuffer() { if (commands != null) { // NOTE: this ignores all the logging statements which is as it should be since they don't // affect output appendCommandsToBuilder(getCommandsAndAddPendingStringData(), delegate); commands = null; } String value = delegate.toString(); delegate.setLength(0); return value; }
@Override protected void notifyContentDirectionality(@Nullable Dir contentDir) throws IOException { if (contentDir == null) { getCommandsAndAddPendingStringData().add(SET_SANITIZED_CONTENT_DIRECTIONALITY_NULL_MARKER); } else { getCommandsAndAddPendingStringData().add(contentDir); } }
@Override protected void notifyContentDirectionality(@Nullable Dir contentDir) throws IOException { if (contentDir == null) { getCommandsAndAddPendingStringData().add(SET_SANITIZED_CONTENT_DIRECTIONALITY_NULL_MARKER); } else { getCommandsAndAddPendingStringData().add(contentDir); } }
public void replayOn(LoggingAdvisingAppendable appendable) throws IOException { if (commands != null) { for (Object o : getCommandsAndAddPendingStringData()) { if (o instanceof String) { appendable.append((String) o); } else if (o instanceof LoggingFunctionCommand) { ((LoggingFunctionCommand) o).replayOn(appendable); } else if (o == EXIT_LOG_STATEMENT_MARKER) { appendable.exitLoggableElement(); } else if (o instanceof LogStatement) { appendable.enterLoggableElement((LogStatement) o); } else if (o instanceof ContentKind) { appendable.setSanitizedContentKind((ContentKind) o); } else if (o instanceof Dir) { appendable.setSanitizedContentDirectionality((Dir) o); } else if (o == SET_SANITIZED_CONTENT_DIRECTIONALITY_NULL_MARKER) { appendable.setSanitizedContentDirectionality(null); } else { throw new AssertionError("unexpected command object: " + o); } } } else { appendable.append(delegate); } }
public void replayOn(LoggingAdvisingAppendable appendable) throws IOException { if (commands != null) { for (Object o : getCommandsAndAddPendingStringData()) { if (o instanceof String) { appendable.append((String) o); } else if (o instanceof LoggingFunctionCommand) { ((LoggingFunctionCommand) o).replayOn(appendable); } else if (o == EXIT_LOG_STATEMENT_MARKER) { appendable.exitLoggableElement(); } else if (o instanceof LogStatement) { appendable.enterLoggableElement((LogStatement) o); } else if (o instanceof ContentKind) { appendable.setSanitizedContentKind((ContentKind) o); } else if (o instanceof Dir) { appendable.setSanitizedContentDirectionality((Dir) o); } else if (o == SET_SANITIZED_CONTENT_DIRECTIONALITY_NULL_MARKER) { appendable.setSanitizedContentDirectionality(null); } else { throw new AssertionError("unexpected command object: " + o); } } } else { appendable.append(delegate); } }
@Override protected void notifyContentKind(ContentKind kind) throws IOException { getCommandsAndAddPendingStringData().add(kind); }
@Override protected void doAppendLoggingFunctionInvocation( LoggingFunctionInvocation funCall, ImmutableList<Function<String, String>> escapers) throws IOException { getCommandsAndAddPendingStringData().add(LoggingFunctionCommand.create(funCall, escapers)); }
/** Called whenever a loggable element is exited. */ @Override protected final void doExitLoggableElement() { getCommandsAndAddPendingStringData().add(EXIT_LOG_STATEMENT_MARKER); }
/** Called whenever a loggable element is entered. */ @Override protected final void doEnterLoggableElement(LogStatement statement) { getCommandsAndAddPendingStringData().add(statement); }
/** Called whenever a loggable element is entered. */ @Override protected final void doEnterLoggableElement(LogStatement statement) { getCommandsAndAddPendingStringData().add(statement); }
@VisibleForTesting public String getAndClearBuffer() { if (commands != null) { // NOTE: this ignores all the logging statements which is as it should be since they don't // affect output appendCommandsToBuilder(getCommandsAndAddPendingStringData(), delegate); commands = null; } String value = delegate.toString(); delegate.setLength(0); return value; }
@Override protected void notifyContentKind(ContentKind kind) throws IOException { getCommandsAndAddPendingStringData().add(kind); }
@Override protected void doAppendLoggingFunctionInvocation( LoggingFunctionInvocation funCall, ImmutableList<Function<String, String>> escapers) throws IOException { getCommandsAndAddPendingStringData().add(LoggingFunctionCommand.create(funCall, escapers)); }
/** Called whenever a loggable element is exited. */ @Override protected final void doExitLoggableElement() { getCommandsAndAddPendingStringData().add(EXIT_LOG_STATEMENT_MARKER); }