Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Put excessive logging behind a config #40

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.github.dcysteine.neicustomdiagram.api.diagram.tooltip.Tooltip;
import com.github.dcysteine.neicustomdiagram.api.draw.Point;
import com.github.dcysteine.neicustomdiagram.main.Logger;
import com.github.dcysteine.neicustomdiagram.main.config.ConfigOptions;
import com.github.dcysteine.neicustomdiagram.util.ComponentTransformer;
import com.github.dcysteine.neicustomdiagram.util.gregtech5.GregTechFluidDictUtil;
import com.github.dcysteine.neicustomdiagram.util.gregtech5.GregTechOreDictUtil;
Expand Down Expand Up @@ -146,19 +147,24 @@ void buildDiagram(ComponentDiagramMatcher.Builder matcherBuilder) {
centrifugedOreOptional = Optional.empty();
}
} else {
Logger.GREGTECH_5_ORE_PROCESSING.warn(
"Crushed ore and purified ore have different thermal centrifuge outputs:"
+ "\n[{}]\n ->\n[{}]\n\n[{}]\n ->\n[{}]",
crushedOre,
crushedOreOutputs,
purifiedOre,
purifiedOreOutputs);
if (ConfigOptions.OREPROC_DEBUG_LOGGING.get()) {
Logger.GREGTECH_5_ORE_PROCESSING.warn(
"Crushed ore and purified ore have different thermal centrifuge outputs:"
+ "\n[{}]\n ->\n[{}]\n\n[{}]\n ->\n[{}]",
crushedOre,
crushedOreOutputs,
purifiedOre,
purifiedOreOutputs);
} else {
Logger.GREGTECH_5_ORE_PROCESSING
.warn("Crushed and purified [{}] have different thermal centrifuge outputs.", crushedOre);
}
centrifugedOreOptional = Optional.empty();
}
} else {
centrifugedOreOptional = crushedOreOptional.flatMap(crushedOre -> {
Logger.GREGTECH_5_ORE_PROCESSING.warn(
"Crushed ore had thermal centrifuge recipe," + " but no ore washing plant recipe: [{}]",
"Crushed ore had thermal centrifuge recipe, but no ore washing plant recipe: [{}]",
crushedOre);
return handleRecipes(
RecipeHandler.RecipeMap.THERMAL_CENTRIFUGE,
Expand Down Expand Up @@ -306,9 +312,8 @@ private Optional<ItemComponent> handleRecipes(RecipeHandler.RecipeMap recipeMap,

List<DisplayComponent> outputs = new ArrayList<>(outputsOptional.get());
ComponentTransformer.removeComponent(outputs, STONE_DUST);
if (outputs.size() == 0) {
if (outputs.isEmpty()) {
Logger.GREGTECH_5_ORE_PROCESSING.warn("Found no recipe outputs: [{}] [{}]", key, input);

return Optional.empty();
}
diagramBuilder.autoInsertIntoSlotGroup(key).insertEachSafe(outputs);
Expand Down Expand Up @@ -339,9 +344,8 @@ private void handleChemicalBathFluid(RecipeHandler.ChemicalBathFluid chemicalBat

List<DisplayComponent> outputs = new ArrayList<>(recipeOptional.get().outputs());
ComponentTransformer.removeComponent(outputs, STONE_DUST);
if (outputs.size() == 0) {
if (outputs.isEmpty()) {
Logger.GREGTECH_5_ORE_PROCESSING.warn("Found no recipe outputs: [{}] [{}]", key, input);

return;
}
diagramBuilder.autoInsertIntoSlotGroup(key).insertIntoNextSlot(fluidDisplayItem.orElse(fluid))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ Optional<ImmutableList<DisplayComponent>> getUniqueRecipeOutput(RecipeMap recipe

if (outputs.size() > 1) {
Logger.GREGTECH_5_ORE_PROCESSING.warn("Found {} recipes: [{}] [{}]", outputs.size(), recipeMap, input);

return Optional.empty();
} else if (outputs.isEmpty()) {
return Optional.empty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public final class ConfigOptions {
Category.OPTIONS,
"tooltip_max_cycle_count",
8,
"Sets the maximum # of cycle components that will be shown in a tooltip" + " when <Shift> is held."
"Sets the maximum # of cycle components that will be shown in a tooltip when <Shift> is held."
+ "\nSet to 0 to disable this feature.").register();

public static final Option<Boolean> NBT_VIEWER_SMALL_TEXT = new BooleanOption(
Expand All @@ -115,6 +115,12 @@ public final class ConfigOptions {
false,
"Enables drawing values on a separate line in the NBT Viewer diagram.").register();

public static final Option<Boolean> OREPROC_DEBUG_LOGGING = new BooleanOption(
Category.OPTIONS,
"oreproc_debug_logging",
false,
"Enables more debug logging when failing to generate diagram for certain ore processing steps").register();

public enum Category {

OPTIONS("options"),
Expand Down