Skip to content

Commit

Permalink
Remove noisy logs from UrlRewriter.
Browse files Browse the repository at this point in the history
UrlRewriter prints log for each URL that is rewritten, in form of
`Rewritten %s as %s`. This causes tens of long logs to be printed,
making logs very noisy.

See also #13764.

Closes #13806.

PiperOrigin-RevId: 391431109
  • Loading branch information
glukasiknuro authored and copybara-github committed Aug 18, 2021
1 parent b8764e4 commit d21345d
Showing 1 changed file with 0 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,10 @@ public class UrlRewriter {

private final UrlRewriterConfig config;
private final Function<URL, List<URL>> rewriter;
private final Consumer<String> log;

@VisibleForTesting
UrlRewriter(Consumer<String> log, String filePathForErrorReporting, Reader reader)
throws UrlRewriterParseException {
this.log = Preconditions.checkNotNull(log);
Preconditions.checkNotNull(reader, "UrlRewriterConfig source must be set");
this.config = new UrlRewriterConfig(filePathForErrorReporting, reader);

Expand Down Expand Up @@ -102,10 +100,6 @@ public List<URL> amend(List<URL> urls) {
ImmutableList<URL> rewritten =
urls.stream().map(rewriter).flatMap(Collection::stream).collect(toImmutableList());

if (!urls.equals(rewritten)) {
log.accept(String.format("Rewritten %s as %s", urls, rewritten));
}

return rewritten;
}

Expand Down

0 comments on commit d21345d

Please sign in to comment.