@@ -14,11 +14,9 @@ import au.com.dius.pact.core.support.Either
14
14
import au.com.dius.pact.core.support.Json
15
15
import au.com.dius.pact.core.support.json.JsonValue
16
16
import au.com.dius.pact.core.support.json.map
17
- import io.github.oshai.kotlinlogging.KotlinLogging
17
+ import io.github.oshai.kotlinlogging.KLogging
18
18
import java.lang.RuntimeException
19
19
20
- private val logger = KotlinLogging .logger {}
21
-
22
20
/* *
23
21
* Logic to use to combine rules
24
22
*/
@@ -65,7 +63,7 @@ interface MatchingRule {
65
63
*/
66
64
val attributes: Map <String , JsonValue >
67
65
68
- companion object {
66
+ companion object : KLogging () {
69
67
private const val MATCH = " match"
70
68
private const val MIN = " min"
71
69
private const val MAX = " max"
@@ -87,12 +85,12 @@ interface MatchingRule {
87
85
j.has(TIME ) -> TimeMatcher (j[TIME ].asString()!! )
88
86
j.has(DATE ) -> DateMatcher (j[DATE ].asString()!! )
89
87
else -> {
90
- logger.warn { " Unrecognised matcher definition $j , defaulting to equality matching" }
88
+ MatchingRuleGroup . logger.warn { " Unrecognised matcher definition $j , defaulting to equality matching" }
91
89
EqualsMatcher
92
90
}
93
91
}
94
92
} else {
95
- logger.warn { " Unrecognised matcher definition $json , defaulting to equality matching" }
93
+ MatchingRuleGroup . logger.warn { " Unrecognised matcher definition $json , defaulting to equality matching" }
96
94
EqualsMatcher
97
95
}
98
96
}
@@ -110,7 +108,7 @@ interface MatchingRule {
110
108
" integer" -> NumberTypeMatcher (NumberTypeMatcher .NumberType .INTEGER )
111
109
" decimal" -> NumberTypeMatcher (NumberTypeMatcher .NumberType .DECIMAL )
112
110
" 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" }
114
112
NumberTypeMatcher (NumberTypeMatcher .NumberType .DECIMAL )
115
113
}
116
114
MIN -> MinTypeMatcher (values[MIN ].asNumber()!! .toInt())
@@ -196,7 +194,7 @@ interface MatchingRule {
196
194
EachValueMatcher (definition)
197
195
}
198
196
else -> {
199
- logger.warn { " Unrecognised matcher ${values[MATCH ]} , defaulting to equality matching" }
197
+ MatchingRuleGroup . logger.warn { " Unrecognised matcher ${values[MATCH ]} , defaulting to equality matching" }
200
198
EqualsMatcher
201
199
}
202
200
}
@@ -678,7 +676,7 @@ data class MatchingRuleGroup @JvmOverloads constructor(
678
676
return rules.any { matchers.contains(it.javaClass) }
679
677
}
680
678
681
- companion object {
679
+ companion object : KLogging () {
682
680
@JvmStatic
683
681
fun fromJson (json : JsonValue ): MatchingRuleGroup {
684
682
var ruleLogic = RuleLogic .AND
@@ -693,7 +691,7 @@ data class MatchingRuleGroup @JvmOverloads constructor(
693
691
ruleLogic = RuleLogic .valueOf(value)
694
692
}
695
693
} 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" }
697
695
}
698
696
}
699
697
0 commit comments