From a663fed42ef97553188cc7cdd2e24b54caab6b20 Mon Sep 17 00:00:00 2001 From: Mike Barry Date: Sat, 16 Sep 2023 14:59:06 -0400 Subject: [PATCH] color big layers --- .../onthegomap/planetiler/util/TileStats.java | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/planetiler-core/src/main/java/com/onthegomap/planetiler/util/TileStats.java b/planetiler-core/src/main/java/com/onthegomap/planetiler/util/TileStats.java index 7c05ae9f7f..159820a38f 100644 --- a/planetiler-core/src/main/java/com/onthegomap/planetiler/util/TileStats.java +++ b/planetiler-core/src/main/java/com/onthegomap/planetiler/util/TileStats.java @@ -264,8 +264,18 @@ public void printStats() { )).collect(Collectors.joining("\n"))); } - LOGGER.debug("Max tile sizes:\n{}\n{}", - writeStatsTable(result, formatter::storage, SummaryCell::maxSize), + LOGGER.debug("Max tile sizes:\n{}\n{}\n{}", + writeStatsTable(result, n -> { + String string = " " + formatter.storage(n, true); + return n.intValue() > 500_000 ? AnsiColors.red(string) : + n.intValue() > 100_000 ? AnsiColors.yellow(string) : + string; + }, SummaryCell::maxSize), + writeStatsRow(result, "full tile", + formatter::storage, + z -> result.get(z).maxSize(), + result.get().maxSize() + ), writeStatsRow(result, "gzipped", formatter::storage, z -> result.get(z).maxArchivedSize(), @@ -345,16 +355,7 @@ private static String writeStatsTable(Summary result, Function f extractStat.apply(result.get(layer)) )).append('\n'); } - - // last layer: total sizes - builder.append(writeStatsRow( - result, - "full tile", - formatter, - z -> extractStat.apply(result.get(z)), - extractStat.apply(result.get()) - )); - return builder.toString(); + return builder.toString().stripTrailing(); } public Updater threadLocalUpdater() {