mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 00:34:19 +00:00
Declutter the boot log
This commit is contained in:
1 parent
2f82ad34a3
commit
673dda2860
15 files changed
+206
-114
No files matched your search
@@ -24,6 +24,8 @@ import art.arcane.iris.configuration.IrisSettings;
|
||||
import art.arcane.iris.configuration.SettingsHotloadWatch;
|
||||
import art.arcane.iris.diagnostics.LogFilterSVC;
|
||||
import art.arcane.iris.diagnostics.splash.IrisSplashComposer;
|
||||
import art.arcane.iris.diagnostics.splash.IrisSplashPackScanner;
|
||||
import art.arcane.iris.pack.DefaultPackBootstrapProvisioner;
|
||||
import art.arcane.iris.generation.concurrent.MultiBurst;
|
||||
import art.arcane.iris.generation.decoration.tree.TreeBlockMaterial;
|
||||
import art.arcane.iris.generation.runtime.BlockEditAccess;
|
||||
@@ -144,6 +146,7 @@ import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@@ -259,7 +262,7 @@ public final class IrisRuntime implements IrisPluginRuntime {
|
||||
if (current == null) {
|
||||
Iris plugin = Iris.instance;
|
||||
current = new VolmitSender(Bukkit.getConsoleSender());
|
||||
current.setTag(plugin == null ? IrisSafeguard.mode().tag("") : plugin.getTag());
|
||||
current.setTag(IrisSafeguard.mode().logTag());
|
||||
sender = current;
|
||||
}
|
||||
return current;
|
||||
@@ -309,14 +312,14 @@ public final class IrisRuntime implements IrisPluginRuntime {
|
||||
ComponentLog.logMarkup(
|
||||
plugin,
|
||||
Logger.getLogger("Iris"),
|
||||
logPrefix(plugin),
|
||||
logPrefix(),
|
||||
Level.INFO,
|
||||
string,
|
||||
null);
|
||||
} catch (Throwable e) {
|
||||
try {
|
||||
Iris plugin = Iris.instance;
|
||||
String plainPrefix = ComponentText.legacy(logPrefix(plugin)).plain();
|
||||
String plainPrefix = ComponentText.legacy(logPrefix()).plain();
|
||||
Logger.getLogger("Iris").log(Level.INFO, plainPrefix + IrisLogging.clean(string));
|
||||
} catch (Throwable inner) {
|
||||
System.err.println("[Iris] Failed to emit log message: " + inner.getMessage());
|
||||
@@ -602,14 +605,14 @@ public final class IrisRuntime implements IrisPluginRuntime {
|
||||
ComponentLog.logLegacy(
|
||||
plugin,
|
||||
Logger.getLogger("Iris"),
|
||||
logPrefix(plugin),
|
||||
logPrefix(),
|
||||
level,
|
||||
message,
|
||||
null);
|
||||
}
|
||||
|
||||
private static String logPrefix(Iris plugin) {
|
||||
return plugin == null ? ComponentLog.discriminator("Iris", "&a") : plugin.getTag();
|
||||
private static String logPrefix() {
|
||||
return IrisSafeguard.mode().logTag();
|
||||
}
|
||||
|
||||
static int irisVersion(String input) {
|
||||
@@ -715,7 +718,7 @@ public final class IrisRuntime implements IrisPluginRuntime {
|
||||
timings.mark("datapacks");
|
||||
IrisSafeguard.execute();
|
||||
timings.mark("safeguard");
|
||||
getSender().setTag(plugin.getTag());
|
||||
getSender().setTag(IrisSafeguard.mode().logTag());
|
||||
// A cosmetic banner must never abort the bootstrap.
|
||||
J.attempt(this::splash);
|
||||
IrisSafeguard.printReports();
|
||||
@@ -814,19 +817,17 @@ public final class IrisRuntime implements IrisPluginRuntime {
|
||||
}
|
||||
|
||||
private static final class EnableTimings {
|
||||
private static final int REPORTED_SERVICES = 3;
|
||||
private static final long REPORTED_PHASE_MIN_MS = 100;
|
||||
private static final long SLOW_SERVICE_MIN_MS = 1000;
|
||||
|
||||
private final long startedAt = System.nanoTime();
|
||||
private final StringBuilder phases = new StringBuilder();
|
||||
private final Map<String, Long> phaseMillis = new LinkedHashMap<>();
|
||||
private final Map<String, Long> serviceMillis = new LinkedHashMap<>();
|
||||
private long lastMark = startedAt;
|
||||
|
||||
private void mark(String phase) {
|
||||
long now = System.nanoTime();
|
||||
if (!phases.isEmpty()) {
|
||||
phases.append(' ');
|
||||
}
|
||||
phases.append(phase).append('=').append(TimeUnit.NANOSECONDS.toMillis(now - lastMark)).append("ms");
|
||||
phaseMillis.put(phase, TimeUnit.NANOSECONDS.toMillis(now - lastMark));
|
||||
lastMark = now;
|
||||
}
|
||||
|
||||
@@ -835,17 +836,26 @@ public final class IrisRuntime implements IrisPluginRuntime {
|
||||
}
|
||||
|
||||
private void report() {
|
||||
IrisLogging.notice("Enabled in %dms (%s)",
|
||||
TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startedAt), phases);
|
||||
String slowest = serviceMillis.entrySet().stream()
|
||||
.sorted(Map.Entry.<String, Long>comparingByValue().reversed())
|
||||
.limit(REPORTED_SERVICES)
|
||||
.map(entry -> entry.getKey() + "=" + entry.getValue() + "ms")
|
||||
.collect(Collectors.joining(" "));
|
||||
if (!slowest.isBlank()) {
|
||||
IrisLogging.notice("Slowest services: %s", slowest);
|
||||
String total = seconds(TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startedAt));
|
||||
String phases = slowestFirst(phaseMillis, REPORTED_PHASE_MIN_MS);
|
||||
IrisLogging.notice(phases.isEmpty() ? "Enabled in " + total : "Enabled in " + total + " (" + phases + ")");
|
||||
String slowServices = slowestFirst(serviceMillis, SLOW_SERVICE_MIN_MS);
|
||||
if (!slowServices.isEmpty()) {
|
||||
IrisLogging.notice("Slow services: " + slowServices);
|
||||
}
|
||||
}
|
||||
|
||||
private static String slowestFirst(Map<String, Long> millisByName, long minimumMillis) {
|
||||
return millisByName.entrySet().stream()
|
||||
.filter(entry -> entry.getValue() >= minimumMillis)
|
||||
.sorted(Map.Entry.<String, Long>comparingByValue().reversed())
|
||||
.map(entry -> entry.getKey() + " " + seconds(entry.getValue()))
|
||||
.collect(Collectors.joining(", "));
|
||||
}
|
||||
|
||||
private static String seconds(long millis) {
|
||||
return String.format(Locale.ROOT, "%.1fs", millis / 1000.0);
|
||||
}
|
||||
}
|
||||
|
||||
private File getTemp() {
|
||||
@@ -1489,15 +1499,34 @@ public final class IrisRuntime implements IrisPluginRuntime {
|
||||
}
|
||||
|
||||
private void splash() {
|
||||
Iris.info("Custom Biomes: " + INMS.get().countCustomBiomes());
|
||||
printPacks();
|
||||
|
||||
IrisSafeguard.mode().trySplash();
|
||||
File packFolder = Iris.service(StudioSVC.class).getWorkspaceFolder();
|
||||
List<IrisSplashPackScanner.SplashPackMetadata> packs = IrisSplashPackScanner.collect(packFolder, Iris::reportError);
|
||||
List<List<IrisSplashComposer.Detail>> startupFacts = startupFacts(packs);
|
||||
if (IrisSettings.get().getGeneral().isSplashLogoStartup()) {
|
||||
printWithoutLogPrefix(IrisSafeguard.mode().composeSplash(startupFacts));
|
||||
} else {
|
||||
startupFacts.forEach(row -> Iris.info(IrisSplashComposer.plainRow(row)));
|
||||
}
|
||||
announcePackUpdates(packs);
|
||||
}
|
||||
|
||||
private void printPacks() {
|
||||
File packFolder = Iris.service(StudioSVC.class).getWorkspaceFolder();
|
||||
IrisSplashComposer.composePackLines(packFolder, Iris::reportError).thenAccept(lines -> {
|
||||
private void printWithoutLogPrefix(String text) {
|
||||
ComponentLog.logLegacy(plugin, Logger.getLogger("Iris"), "", Level.INFO, text, null);
|
||||
}
|
||||
|
||||
private static List<List<IrisSplashComposer.Detail>> startupFacts(List<IrisSplashPackScanner.SplashPackMetadata> packs) {
|
||||
boolean eagerInjection = IrisSettings.get().getGeneral().isEagerRuntimeInjection();
|
||||
boolean datapackFromBootstrap = DefaultPackBootstrapProvisioner.wasProvisionedThisStartup();
|
||||
return List.of(
|
||||
List.of(new IrisSplashComposer.Detail("Packs", IrisSplashComposer.packSummary(packs))),
|
||||
List.of(new IrisSplashComposer.Detail("Custom biomes", String.valueOf(INMS.get().countCustomBiomes()))),
|
||||
List.of(new IrisSplashComposer.Detail("SIMD", SimdSupport.shortStatus()),
|
||||
new IrisSplashComposer.Detail("Datapack", datapackFromBootstrap ? "bootstrap" : "startup install"),
|
||||
new IrisSplashComposer.Detail("Injection", eagerInjection ? "eager" : "deferred")));
|
||||
}
|
||||
|
||||
private void announcePackUpdates(List<IrisSplashPackScanner.SplashPackMetadata> packs) {
|
||||
IrisSplashComposer.composeUpdateLines(packs).thenAccept(lines -> {
|
||||
if (plugin.isEnabled()) {
|
||||
lines.forEach(Iris::info);
|
||||
}
|
||||
|
||||
+2
-4
@@ -243,12 +243,10 @@ public final class IrisWorldGeneratorResolver {
|
||||
Iris.info("Pack '" + result.getPackName() + "' is waiting for external block providers to initialize.");
|
||||
continue;
|
||||
}
|
||||
PackBootReporter.logBroken(result);
|
||||
PackBootReporter.logBroken(result, minecraftVersion);
|
||||
} else {
|
||||
PackBootReporter.logValidated(result, minecraftVersion, cached.isEmpty());
|
||||
PackBootReporter.logValidated(result, minecraftVersion, false);
|
||||
}
|
||||
// Cache hits carry the persisted findings, so the listing prints on every boot, not only after a miss.
|
||||
PackBootReporter.logCompat(result, minecraftVersion);
|
||||
}
|
||||
IrisStartupValidation.markPacksReady();
|
||||
}
|
||||
|
||||
@@ -145,9 +145,8 @@ public final class ModdedStartup {
|
||||
if (result.isLoadable()) {
|
||||
PackBootReporter.logValidated(result, minecraftVersion, true);
|
||||
} else {
|
||||
PackBootReporter.logBroken(result);
|
||||
PackBootReporter.logBroken(result, minecraftVersion);
|
||||
}
|
||||
PackBootReporter.logCompat(result, minecraftVersion);
|
||||
} catch (Throwable e) {
|
||||
ModdedIrisLog.error("Iris pack validation failed for '{}'", packDir.getName(), e);
|
||||
String detail = e.getMessage();
|
||||
|
||||
@@ -3,21 +3,68 @@ package art.arcane.iris.diagnostics.splash;
|
||||
import art.arcane.iris.BuildConstants;
|
||||
import art.arcane.iris.pack.BuiltInPackUpdates;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public final class IrisSplashComposer {
|
||||
private static final String SPLASH_PADDING = " ".repeat(4);
|
||||
private static final int FIRST_SPARE_INFO_ROW = 8;
|
||||
private static final int SPARE_INFO_ROWS = 3;
|
||||
private static final int PACKS_SHOWN = 6;
|
||||
private static final int SHORT_COMMIT_LENGTH = 7;
|
||||
|
||||
private IrisSplashComposer() {
|
||||
}
|
||||
|
||||
public static String[] composeInfo(String version, String serverLine, InfoStyle style) {
|
||||
return composeInfo(version, serverLine, style, List.of());
|
||||
}
|
||||
|
||||
public static String[] composeInfo(String version, String serverLine, InfoStyle style, List<List<Detail>> detailRows) {
|
||||
String[] info = composeHeader(version, serverLine, style);
|
||||
int rows = Math.min(detailRows.size(), SPARE_INFO_ROWS);
|
||||
for (int row = 0; row < rows; row++) {
|
||||
info[FIRST_SPARE_INFO_ROW + row] = style.linePrefix() + styledRow(detailRows.get(row), style);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
public static String plainRow(List<Detail> row) {
|
||||
return styledRow(row, InfoStyle.PLAIN).strip();
|
||||
}
|
||||
|
||||
public static String packSummary(List<IrisSplashPackScanner.SplashPackMetadata> packs) {
|
||||
if (packs.isEmpty()) {
|
||||
return "none";
|
||||
}
|
||||
String shown = packs.stream()
|
||||
.limit(PACKS_SHOWN)
|
||||
.map(pack -> pack.name() + " v" + pack.version())
|
||||
.collect(Collectors.joining(", "));
|
||||
int hidden = packs.size() - PACKS_SHOWN;
|
||||
return hidden > 0 ? shown + " +" + hidden + " more" : shown;
|
||||
}
|
||||
|
||||
private static String styledRow(List<Detail> row, InfoStyle style) {
|
||||
StringBuilder styled = new StringBuilder();
|
||||
for (Detail detail : row) {
|
||||
String separator = styled.isEmpty() ? " " : " | ";
|
||||
styled.append(style.label(separator + detail.label() + ": ")).append(style.value(detail.value()));
|
||||
}
|
||||
return styled.toString();
|
||||
}
|
||||
|
||||
private static String shortCommit() {
|
||||
String commit = BuildConstants.COMMIT;
|
||||
return commit.length() > SHORT_COMMIT_LENGTH ? commit.substring(0, SHORT_COMMIT_LENGTH) : commit;
|
||||
}
|
||||
|
||||
private static String[] composeHeader(String version, String serverLine, InfoStyle style) {
|
||||
String releaseTrain = releaseTrain(version);
|
||||
String prefix = style.linePrefix();
|
||||
return new String[]{
|
||||
@@ -28,7 +75,7 @@ public final class IrisSplashComposer {
|
||||
prefix + style.label(" Web: ") + style.value("VolmitSoftware.com"),
|
||||
prefix + style.label(" Server: ") + style.value(serverLine),
|
||||
prefix + style.label(" Java: ") + style.value(javaVersion() < 0 ? "unknown" : String.valueOf(javaVersion())) + style.label(" | Date: ") + style.value(startupDate()),
|
||||
prefix + style.label(" Commit: ") + style.value(BuildConstants.COMMIT) + style.label("/") + style.value(BuildConstants.ENVIRONMENT),
|
||||
prefix + style.label(" Commit: ") + style.value(shortCommit()) + style.label("/") + style.value(BuildConstants.ENVIRONMENT),
|
||||
"",
|
||||
"",
|
||||
""
|
||||
@@ -43,25 +90,14 @@ public final class IrisSplashComposer {
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public static CompletableFuture<List<String>> composePackLines(File packFolder, IrisSplashPackScanner.SplashPackErrorReporter reporter) {
|
||||
List<IrisSplashPackScanner.SplashPackMetadata> packs = IrisSplashPackScanner.collect(packFolder, reporter);
|
||||
public static CompletableFuture<List<String>> composeUpdateLines(List<IrisSplashPackScanner.SplashPackMetadata> packs) {
|
||||
return BuiltInPackUpdates.check(packs.stream().map(IrisSplashPackScanner.SplashPackMetadata::name).toList())
|
||||
.thenApply(updates -> composePackLines(packs, updates));
|
||||
.thenApply(updates -> composeUpdateLines(packs, updates));
|
||||
}
|
||||
|
||||
static List<String> composePackLines(List<IrisSplashPackScanner.SplashPackMetadata> packs,
|
||||
Map<String, BuiltInPackUpdates.Update> updates) {
|
||||
if (packs.isEmpty()) {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
List<String> lines = new ArrayList<>(packs.size() + 1);
|
||||
lines.add("Custom Dimensions: " + packs.size());
|
||||
for (IrisSplashPackScanner.SplashPackMetadata pack : packs) {
|
||||
BuiltInPackUpdates.Update update = updates.get(pack.name());
|
||||
lines.add(" " + pack.name() + " v" + pack.version()
|
||||
+ (update == null ? "" : update.suffix(pack.version())));
|
||||
}
|
||||
static List<String> composeUpdateLines(List<IrisSplashPackScanner.SplashPackMetadata> packs,
|
||||
Map<String, BuiltInPackUpdates.Update> updates) {
|
||||
List<String> lines = new ArrayList<>();
|
||||
for (IrisSplashPackScanner.SplashPackMetadata pack : packs) {
|
||||
BuiltInPackUpdates.Update update = updates.get(pack.name());
|
||||
if (update != null && update.newerThan(pack.version())) {
|
||||
@@ -106,6 +142,9 @@ public final class IrisSplashComposer {
|
||||
return LocalDate.now().format(DateTimeFormatter.ISO_LOCAL_DATE);
|
||||
}
|
||||
|
||||
public record Detail(String label, String value) {
|
||||
}
|
||||
|
||||
public interface InfoStyle {
|
||||
InfoStyle PLAIN = new InfoStyle() {
|
||||
};
|
||||
|
||||
@@ -4,9 +4,11 @@ import art.arcane.iris.spi.IrisLogging;
|
||||
import art.arcane.iris.configuration.IrisSettings;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public final class SimdSupport {
|
||||
private static final String VECTOR_MODULE = "jdk.incubator.vector";
|
||||
private static final Pattern VECTOR_SHAPE_BITS = Pattern.compile("^.*S_(\\d+)_BIT.*$");
|
||||
private static final boolean MODULE_PRESENT = ModuleLayer.boot().findModule(VECTOR_MODULE).isPresent();
|
||||
private static final AtomicReference<Throwable> KERNEL_FAILURE = new AtomicReference<>();
|
||||
private static final SimdKernels KERNELS = selectKernels();
|
||||
@@ -54,8 +56,19 @@ public final class SimdSupport {
|
||||
return "scalar kernels active; the Vector API reported no usable vector shape on this CPU";
|
||||
}
|
||||
|
||||
public static String shortStatus() {
|
||||
if (!isVectorized()) {
|
||||
return "scalar";
|
||||
}
|
||||
return VECTOR_SHAPE_BITS.matcher(KERNELS.describe()).replaceFirst("$1-bit");
|
||||
}
|
||||
|
||||
public static void install() {
|
||||
IrisLogging.info("SIMD: " + kernelStatus());
|
||||
if (isVectorized()) {
|
||||
IrisLogging.debug("SIMD: " + kernelStatus());
|
||||
} else {
|
||||
IrisLogging.info("SIMD: " + kernelStatus());
|
||||
}
|
||||
|
||||
Throwable failure = KERNEL_FAILURE.get();
|
||||
if (failure != null) {
|
||||
|
||||
@@ -615,11 +615,11 @@ public final class IrisLanguage {
|
||||
IrisLogging.info("Updated Iris language " + locale + " from " + source + ": " + result.summary() + ".");
|
||||
}
|
||||
if (report.coolingDown()) {
|
||||
IrisLogging.info("Iris language source " + sourceDescription() + " was checked recently; the next check is allowed in "
|
||||
IrisLogging.debug("Iris language source " + sourceDescription() + " was checked recently; the next check is allowed in "
|
||||
+ report.cooldownRemaining() + ".");
|
||||
} else if (report.failure().isEmpty() && report.changedLocales().isEmpty() && report.failures().isEmpty()
|
||||
&& report.revision().isPresent()) {
|
||||
IrisLogging.info("Iris languages match " + sourceDescription() + " (" + revision + ").");
|
||||
IrisLogging.debug("Iris languages match " + sourceDescription() + " (" + revision + ").");
|
||||
}
|
||||
return report;
|
||||
}
|
||||
|
||||
@@ -3,53 +3,60 @@ package art.arcane.iris.pack;
|
||||
import art.arcane.iris.localization.ChatReport;
|
||||
import art.arcane.iris.pack.validation.PackCompatReport;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** Console output for pack validation at startup, shared by every platform so the boot log reads the same. */
|
||||
public final class PackBootReporter {
|
||||
private static final int BOOT_ITEM_LIMIT = 5;
|
||||
private static final int COMPAT_SUBJECTS_PER_KEY = 3;
|
||||
private static final int COMPAT_KEYS_SHOWN = 2;
|
||||
private static final Pattern SENTENCE_BREAK = Pattern.compile("(?<=[.!?])\\s+(?=[A-Z\\[])");
|
||||
|
||||
private PackBootReporter() {
|
||||
}
|
||||
|
||||
public static void logBroken(PackValidationResult result) {
|
||||
public static void logBroken(PackValidationResult result, String minecraftVersion) {
|
||||
String pack = result.getPackName();
|
||||
logCapped(ChatReport.Tone.ERROR,
|
||||
"Pack '" + pack + "' failed validation; world and Studio creation with it are refused",
|
||||
pack, result.getBlockingErrors());
|
||||
logReport(ChatReport.Tone.ERROR,
|
||||
"Pack '" + pack + "' failed validation, worlds and Studio refuse it",
|
||||
result, minecraftVersion, result.getBlockingErrors());
|
||||
}
|
||||
|
||||
public static void logValidated(PackValidationResult result, String minecraftVersion, boolean announceClean) {
|
||||
String pack = result.getPackName();
|
||||
String compatSummary = PackValidator.compatSummary(result, minecraftVersion);
|
||||
String compatSuffix = compatSummary.isEmpty() ? "" : " " + compatSummary;
|
||||
if (!result.getWarnings().isEmpty()) {
|
||||
logCapped(ChatReport.Tone.WARNING,
|
||||
"Pack '" + pack + "' validated with " + result.getWarnings().size() + " warning(s)." + compatSuffix,
|
||||
pack, result.getWarnings());
|
||||
int warnings = result.getWarnings().size();
|
||||
if (warnings > 0) {
|
||||
logReport(ChatReport.Tone.WARNING,
|
||||
"Pack '" + pack + "': " + warnings + (warnings == 1 ? " warning" : " warnings"),
|
||||
result, minecraftVersion, result.getWarnings());
|
||||
return;
|
||||
}
|
||||
if (announceClean || !compatSummary.isEmpty()) {
|
||||
ChatReport.of(ChatReport.Tone.SUCCESS, "Pack '" + pack + "' validated." + compatSuffix).build().log();
|
||||
if (!result.getCompatFindings().isEmpty()) {
|
||||
logReport(ChatReport.Tone.WARNING, "Pack '" + pack + "': content unavailable",
|
||||
result, minecraftVersion, List.of());
|
||||
return;
|
||||
}
|
||||
if (announceClean) {
|
||||
ChatReport.of(ChatReport.Tone.SUCCESS, "Pack '" + pack + "' validated").build().log();
|
||||
}
|
||||
}
|
||||
|
||||
public static void logCompat(PackValidationResult result, String minecraftVersion) {
|
||||
if (result == null || result.getCompatFindings().isEmpty()) {
|
||||
return;
|
||||
private static void logReport(ChatReport.Tone tone, String title, PackValidationResult result,
|
||||
String minecraftVersion, List<String> reasons) {
|
||||
String pack = result.getPackName();
|
||||
List<String> items = new ArrayList<>(reasons.size() + 1);
|
||||
reasons.forEach(reason -> items.add(firstSentence(reason)));
|
||||
String details = "/iris pack validate " + pack;
|
||||
if (!result.getCompatFindings().isEmpty()) {
|
||||
items.add(PackCompatReport.of(result.getCompatFindings())
|
||||
.bootItem(PackValidator.versionOf(result, minecraftVersion), COMPAT_KEYS_SHOWN));
|
||||
details += ", /iris pack compat " + pack;
|
||||
}
|
||||
PackCompatReport.of(result.getCompatFindings())
|
||||
.bootReport(result.getPackName(), PackValidator.versionOf(result, minecraftVersion),
|
||||
COMPAT_SUBJECTS_PER_KEY, BOOT_ITEM_LIMIT)
|
||||
.log();
|
||||
ChatReport.of(tone, title).items(items).limit(BOOT_ITEM_LIMIT).hint("Details: " + details, null).build().log();
|
||||
}
|
||||
|
||||
private static void logCapped(ChatReport.Tone tone, String title, String pack, List<String> items) {
|
||||
ChatReport.Builder report = ChatReport.of(tone, title).items(items).limit(BOOT_ITEM_LIMIT);
|
||||
if (items.size() > BOOT_ITEM_LIMIT) {
|
||||
report.hint("/iris pack validate " + pack + " lists everything", null);
|
||||
}
|
||||
report.build().log();
|
||||
private static String firstSentence(String reason) {
|
||||
return SENTENCE_BREAK.split(reason, 2)[0];
|
||||
}
|
||||
}
|
||||
@@ -94,7 +94,7 @@ public final class DatapackIngestService {
|
||||
urls,
|
||||
localFingerprint)) {
|
||||
DatapackStartupValidation.activeStartupValidation = cached;
|
||||
IrisLogging.info("External datapacks match the persisted startup validation; remote resolution and full revalidation were skipped.");
|
||||
IrisLogging.debug("External datapacks match the persisted startup validation; remote resolution and full revalidation were skipped.");
|
||||
IrisStartupValidation.markDatapacksReady();
|
||||
return StartupValidationOutcome.READY;
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ public class ServerConfigurator {
|
||||
&& pinLoadedDatapackCompilerInputs(
|
||||
DefaultPackBootstrapProvisioner.compilerInputFingerprintThisStartup())
|
||||
&& pinLoadedDatapackRegistryRequirements();
|
||||
IrisLogging.info("Paper loaded the Iris datapack during bootstrap; skipping the legacy startup install.");
|
||||
IrisLogging.debug("Paper loaded the Iris datapack during bootstrap; skipping the legacy startup install.");
|
||||
} else {
|
||||
DatapackInstallResult result = installDataPacks(true);
|
||||
loadedDatapackRuntimeReady = result.succeeded()
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
*/
|
||||
package art.arcane.iris.pack.validation;
|
||||
|
||||
import art.arcane.iris.localization.ChatReport;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
@@ -167,16 +166,15 @@ public final class PackCompatReport {
|
||||
return lines;
|
||||
}
|
||||
|
||||
/** The boot listing as a themed report, capped to {@code maxKeys} keys; null when there are no findings. */
|
||||
public synchronized ChatReport bootReport(String packName, String minecraftVersion, int perKeyCap, int maxKeys) {
|
||||
if (findings.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
return ChatReport.of(ChatReport.Tone.WARNING, bootHeader(packName, minecraftVersion))
|
||||
.items(keyLines(perKeyCap))
|
||||
.limit(maxKeys)
|
||||
.hint(bootRemedy(packName), null)
|
||||
.build();
|
||||
/** {@code 4 content keys unavailable on Minecraft 26.3: create:limestone, create:scoria +2 more} */
|
||||
public synchronized String bootItem(String minecraftVersion, int maxKeys) {
|
||||
List<String> keys = byKey().values().stream().map(group -> group.getFirst().key()).toList();
|
||||
int shown = Math.min(maxKeys, keys.size());
|
||||
int hidden = keys.size() - shown;
|
||||
return keys.size() + (keys.size() == 1 ? " content key" : " content keys")
|
||||
+ " unavailable on Minecraft " + versionOrUnknown(minecraftVersion) + ": "
|
||||
+ String.join(", ", keys.subList(0, shown))
|
||||
+ (hidden > 0 ? " +" + hidden + " more" : "");
|
||||
}
|
||||
|
||||
private static String bootHeader(String packName, String minecraftVersion) {
|
||||
|
||||
@@ -67,8 +67,7 @@ public class Agent {
|
||||
return false;
|
||||
|
||||
try {
|
||||
IrisLogging.info("Installing Java Agent...");
|
||||
IrisLogging.info("Note: JVM [Attach Listener/ERROR] [STDERR] warning lines during this step are expected and not Iris errors.");
|
||||
IrisLogging.info("Installing Java agent, the JVM warnings below are expected");
|
||||
ByteBuddyAgent.attach(AGENT_JAR, ByteBuddyAgent.ProcessProvider.ForCurrentVm.INSTANCE);
|
||||
} catch (Throwable e) {
|
||||
IrisLogging.error("Failed to install Java Agent: " + e.getMessage());
|
||||
|
||||
@@ -154,7 +154,7 @@ public class StudioSVC implements IrisService {
|
||||
String configuredPack = IrisSettings.get().getGenerator().getDefaultWorldType();
|
||||
if (!PackDownloader.isPackPresent(getWorkspaceFolder(), configuredPack)) {
|
||||
IrisLogging.warn("Default pack '" + configuredPack
|
||||
+ "' is not installed. Install a built-in pack with /iris download pack=overworld or provide /iris download link=<zip-url>.");
|
||||
+ "' is not installed: /iris download pack=overworld");
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
@@ -105,12 +105,16 @@ public final class IrisSafeguard {
|
||||
|
||||
public static void printReports() {
|
||||
switch (mode) {
|
||||
case STABLE -> IrisLogging.info(C.BLUE + "0 Conflicts found");
|
||||
case STABLE -> {
|
||||
}
|
||||
case WARNING -> IrisLogging.warn(C.GOLD + "%s Issues found", count);
|
||||
case UNSTABLE -> IrisLogging.error(C.DARK_RED + "%s Issues found", count);
|
||||
}
|
||||
|
||||
for (CheckResult value : results.values()) {
|
||||
if (value.mode() == Mode.STABLE) {
|
||||
continue;
|
||||
}
|
||||
// Without the stack trace: Diagnostic.Logger splits on newlines, so a trace became one log
|
||||
// record per frame at the diagnostic's own severity. Traces go through reportError.
|
||||
value.log(true, false);
|
||||
@@ -119,7 +123,7 @@ public final class IrisSafeguard {
|
||||
|
||||
public static void printFooter() {
|
||||
switch (mode) {
|
||||
case STABLE -> IrisLogging.info(C.BLUE + "Iris is running Stable");
|
||||
case STABLE -> IrisLogging.info(C.BLUE + "Stable, 0 conflicts");
|
||||
case WARNING -> warning();
|
||||
case UNSTABLE -> unstable();
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
package art.arcane.iris.world.safeguard;
|
||||
|
||||
import art.arcane.iris.configuration.IrisSettings;
|
||||
import art.arcane.iris.diagnostics.splash.IrisSplashComposer;
|
||||
import art.arcane.iris.diagnostics.splash.IrisSplashRenderer;
|
||||
import art.arcane.iris.platform.bukkit.BukkitPlatform;
|
||||
import art.arcane.iris.spi.IrisLogging;
|
||||
import art.arcane.iris.localization.C;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public enum Mode {
|
||||
@@ -43,18 +42,15 @@ public enum Mode {
|
||||
return wrap("Iris") + " " + wrap(subTag) + C.GRAY + ": ";
|
||||
}
|
||||
|
||||
public void trySplash() {
|
||||
if (!IrisSettings.get().getGeneral().isSplashLogoStartup()) {
|
||||
return;
|
||||
}
|
||||
splash();
|
||||
public String logTag() {
|
||||
return color.toString() + C.BOLD + "Iris" + C.RESET + C.DARK_GRAY + " | " + C.RESET;
|
||||
}
|
||||
|
||||
public void splash() {
|
||||
public String composeSplash(List<List<IrisSplashComposer.Detail>> detailRows) {
|
||||
String version = BukkitPlatform.plugin().getDescription().getVersion();
|
||||
String[] splash = IrisSplashRenderer.render(this::splashTone);
|
||||
String[] info = IrisSplashComposer.composeInfo(version, getServerVersion(), infoStyle());
|
||||
IrisLogging.info(IrisSplashComposer.compose(splash, info));
|
||||
String[] info = IrisSplashComposer.composeInfo(version, getServerVersion(), infoStyle(), detailRows);
|
||||
return IrisSplashComposer.compose(splash, info);
|
||||
}
|
||||
|
||||
private IrisSplashComposer.InfoStyle infoStyle() {
|
||||
|
||||
@@ -11,16 +11,26 @@ import static org.junit.Assert.assertFalse;
|
||||
|
||||
public class IrisSplashComposerTest {
|
||||
@Test
|
||||
public void packLinesShowUpdatesAndKeepCustomPacks() {
|
||||
public void updateLinesNameOnlyOutdatedPacks() {
|
||||
List<IrisSplashPackScanner.SplashPackMetadata> packs = List.of(
|
||||
new IrisSplashPackScanner.SplashPackMetadata("custom", "7"),
|
||||
new IrisSplashPackScanner.SplashPackMetadata("overworld", "4009"),
|
||||
new IrisSplashPackScanner.SplashPackMetadata("underworld", "1012"));
|
||||
assertEquals(List.of("Custom Dimensions: 3", " custom v7", " overworld v4009 -> v4010 available",
|
||||
" underworld v1012", "Update overworld: /iris download pack=overworld overwrite=true"),
|
||||
IrisSplashComposer.composePackLines(packs, Map.of(
|
||||
assertEquals(List.of("Update overworld: /iris download pack=overworld overwrite=true"),
|
||||
IrisSplashComposer.composeUpdateLines(packs, Map.of(
|
||||
"overworld", new BuiltInPackUpdates.Update("4010"),
|
||||
"underworld", new BuiltInPackUpdates.Update("1012"))));
|
||||
assertEquals("custom v7, overworld v4009, underworld v1012", IrisSplashComposer.packSummary(packs));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void detailRowsFillTheSpareSplashRows() {
|
||||
String[] info = IrisSplashComposer.composeInfo("4.0.0-26.2", "Paper 26.2", IrisSplashComposer.InfoStyle.PLAIN,
|
||||
List.of(List.of(new IrisSplashComposer.Detail("SIMD", "256-bit"),
|
||||
new IrisSplashComposer.Detail("Injection", "deferred"))));
|
||||
|
||||
assertEquals(11, info.length);
|
||||
assertEquals(" SIMD: 256-bit | Injection: deferred", info[8]);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in new issue
Block a user