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