@@ -14,11 +14,9 @@ import au.com.dius.pact.core.support.Either
1414import au.com.dius.pact.core.support.Json
1515import au.com.dius.pact.core.support.json.JsonValue
1616import au.com.dius.pact.core.support.json.map
17- import io.github.oshai.kotlinlogging.KotlinLogging
17+ import io.github.oshai.kotlinlogging.KLogging
1818import java.lang.RuntimeException
1919
20- private val logger = KotlinLogging .logger {}
21-
2220/* *
2321 * Logic to use to combine rules
2422 */
@@ -65,7 +63,7 @@ interface MatchingRule {
6563 */
6664 val attributes: Map <String , JsonValue >
6765
68- companion object {
66+ companion object : KLogging () {
6967 private const val MATCH = " match"
7068 private const val MIN = " min"
7169 private const val MAX = " max"
@@ -87,12 +85,12 @@ interface MatchingRule {
8785 j.has(TIME ) -> TimeMatcher (j[TIME ].asString()!! )
8886 j.has(DATE ) -> DateMatcher (j[DATE ].asString()!! )
8987 else -> {
90- logger.warn { " Unrecognised matcher definition $j , defaulting to equality matching" }
88+ MatchingRuleGroup . logger.warn { " Unrecognised matcher definition $j , defaulting to equality matching" }
9189 EqualsMatcher
9290 }
9391 }
9492 } else {
95- logger.warn { " Unrecognised matcher definition $json , defaulting to equality matching" }
93+ MatchingRuleGroup . logger.warn { " Unrecognised matcher definition $json , defaulting to equality matching" }
9694 EqualsMatcher
9795 }
9896 }
@@ -110,7 +108,7 @@ interface MatchingRule {
110108 " integer" -> NumberTypeMatcher (NumberTypeMatcher .NumberType .INTEGER )
111109 " decimal" -> NumberTypeMatcher (NumberTypeMatcher .NumberType .DECIMAL )
112110 " real" -> {
113- logger.warn { " The 'real' type matcher is deprecated, use 'decimal' instead" }
111+ MatchingRuleGroup . logger.warn { " The 'real' type matcher is deprecated, use 'decimal' instead" }
114112 NumberTypeMatcher (NumberTypeMatcher .NumberType .DECIMAL )
115113 }
116114 MIN -> MinTypeMatcher (values[MIN ].asNumber()!! .toInt())
@@ -196,7 +194,7 @@ interface MatchingRule {
196194 EachValueMatcher (definition)
197195 }
198196 else -> {
199- logger.warn { " Unrecognised matcher ${values[MATCH ]} , defaulting to equality matching" }
197+ MatchingRuleGroup . logger.warn { " Unrecognised matcher ${values[MATCH ]} , defaulting to equality matching" }
200198 EqualsMatcher
201199 }
202200 }
@@ -678,7 +676,7 @@ data class MatchingRuleGroup @JvmOverloads constructor(
678676 return rules.any { matchers.contains(it.javaClass) }
679677 }
680678
681- companion object {
679+ companion object : KLogging () {
682680 @JvmStatic
683681 fun fromJson (json : JsonValue ): MatchingRuleGroup {
684682 var ruleLogic = RuleLogic .AND
@@ -693,7 +691,7 @@ data class MatchingRuleGroup @JvmOverloads constructor(
693691 ruleLogic = RuleLogic .valueOf(value)
694692 }
695693 } catch (e: IllegalArgumentException ) {
696- logger.warn { " ${groupJson[" combine" ]} is not a valid matcher rule logic value: ${e.message} " }
694+ logger.warn { " ${groupJson[" combine" ]} is not a valid matcher rule logic value" }
697695 }
698696 }
699697
0 commit comments