mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-31 15:19:29 +07:00
Omit irrelevant warnings from startup console log (#9032)
This commit is contained in:
@ -506,8 +506,13 @@ object RulesetCache : HashMap<String,Ruleset>() {
|
||||
debug("Mod loaded successfully: %s", modRuleset.name)
|
||||
if (Log.shouldLog()) {
|
||||
val modLinksErrors = modRuleset.checkModLinks()
|
||||
if (modLinksErrors.any()) {
|
||||
debug("checkModLinks errors: %s", modLinksErrors.getErrorText())
|
||||
// For extension mods which use references to base ruleset objects, the parameter type
|
||||
// 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) {
|
||||
|
@ -572,7 +572,9 @@ class RulesetErrorList : ArrayList<RulesetError>() {
|
||||
fun isWarnUser() = getFinalSeverity() >= RulesetErrorSeverity.Warning
|
||||
|
||||
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 }
|
||||
.joinToString("\n") { it.errorSeverityToReport.name + ": " + it.text }
|
||||
}
|
||||
|
Reference in New Issue
Block a user