mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 06:16:37 -04:00
Omit irrelevant warnings from startup console log (#9032)
This commit is contained in:
parent
60a0a856ab
commit
666c9c5b29
@ -506,8 +506,13 @@ object RulesetCache : HashMap<String,Ruleset>() {
|
|||||||
debug("Mod loaded successfully: %s", modRuleset.name)
|
debug("Mod loaded successfully: %s", modRuleset.name)
|
||||||
if (Log.shouldLog()) {
|
if (Log.shouldLog()) {
|
||||||
val modLinksErrors = modRuleset.checkModLinks()
|
val modLinksErrors = modRuleset.checkModLinks()
|
||||||
if (modLinksErrors.any()) {
|
// For extension mods which use references to base ruleset objects, the parameter type
|
||||||
debug("checkModLinks errors: %s", modLinksErrors.getErrorText())
|
// errors are irrelevant - the checker ran without a base ruleset
|
||||||
|
val logFilter: (RulesetError) -> Boolean =
|
||||||
|
if (modRuleset.modOptions.isBaseRuleset) { { it.errorSeverityToReport > RulesetErrorSeverity.WarningOptionsOnly } }
|
||||||
|
else { { it.errorSeverityToReport > RulesetErrorSeverity.WarningOptionsOnly && !it.text.contains("does not fit parameter type") } }
|
||||||
|
if (modLinksErrors.any(logFilter)) {
|
||||||
|
debug("checkModLinks errors: %s", modLinksErrors.getErrorText(logFilter))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (ex: Exception) {
|
} catch (ex: Exception) {
|
||||||
|
@ -572,7 +572,9 @@ class RulesetErrorList : ArrayList<RulesetError>() {
|
|||||||
fun isWarnUser() = getFinalSeverity() >= RulesetErrorSeverity.Warning
|
fun isWarnUser() = getFinalSeverity() >= RulesetErrorSeverity.Warning
|
||||||
|
|
||||||
fun getErrorText(unfiltered: Boolean = false) =
|
fun getErrorText(unfiltered: Boolean = false) =
|
||||||
filter { unfiltered || it.errorSeverityToReport != RulesetErrorSeverity.WarningOptionsOnly }
|
getErrorText { unfiltered || it.errorSeverityToReport != RulesetErrorSeverity.WarningOptionsOnly }
|
||||||
|
fun getErrorText(filter: (RulesetError)->Boolean) =
|
||||||
|
filter(filter)
|
||||||
.sortedByDescending { it.errorSeverityToReport }
|
.sortedByDescending { it.errorSeverityToReport }
|
||||||
.joinToString("\n") { it.errorSeverityToReport.name + ": " + it.text }
|
.joinToString("\n") { it.errorSeverityToReport.name + ": " + it.text }
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user