Skip to content

Commit cfb61cd

Browse files
committed
add debug logging
1 parent 4941e36 commit cfb61cd

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ buildscript {
88
ext.mockito_inline_version = '2.19.0'
99
ext.kotlin_unsigned_version = 'v3.1.2'
1010
ext.kotlinx_coroutines_version = '0.23.3'
11+
ext.kotlin_logging = "1.5.9"
1112
ext.kluent_version = '1.38'
1213
ext.jackson_version = '2.9.6'
1314
ext.guava_version = '25.1-jre'

etherspace-java/build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ dependencies {
2424
compileOnly "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:$kotlinx_coroutines_version"
2525
testCompile "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:$kotlinx_coroutines_version"
2626

27+
// klogging
28+
compile "io.github.microutils:kotlin-logging:$kotlin_logging"
29+
2730
// kotlin-unsigned
2831
compile "com.github.kotlin-graphics:kotlin-unsigned:$kotlin_unsigned_version"
2932

etherspace-java/src/main/java/cc/etherspace/EtherSpace.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package cc.etherspace
33
import cc.etherspace.calladapter.CallAdapter
44
import cc.etherspace.calladapter.PassThroughCallAdaptor
55
import cc.etherspace.web3j.Web3jAdapter
6-
import com.fasterxml.jackson.databind.exc.MismatchedInputException
76
import com.google.common.reflect.TypeToken
7+
import mu.KotlinLogging
88
import okhttp3.OkHttpClient
99
import java.io.IOException
1010
import java.lang.reflect.AnnotatedElement
@@ -86,6 +86,8 @@ class EtherSpace(val web3: Web3,
8686

8787
val encodedFunction = web3.abi.encodeFunctionCall(args, functionName)
8888
val transactionHash = np.provideNonce(web3, cd.address) { nonce ->
89+
logger.debug { "invokeTransaction:from=${cd.address},to=$toAddress,function=$functionName,args=$args,options=$options" }
90+
8991
val transactionObject = Web3.TransactionObject(cd.address,
9092
toAddress,
9193
encodedFunction,
@@ -113,6 +115,8 @@ class EtherSpace(val web3: Web3,
113115
args: List<Any>,
114116
returnType: Type,
115117
options: Options): Any {
118+
logger.debug { "invokeView:to=$toAddress,function=$functionName,args=$args" }
119+
116120
val encodedFunction = web3.abi.encodeFunctionCall(args, functionName)
117121
val transactionObject = Web3.TransactionObject(null,
118122
toAddress,
@@ -166,5 +170,6 @@ class EtherSpace(val web3: Web3,
166170
inline fun build(block: Builder.() -> Unit) = Builder().apply(block).build()
167171
internal const val GET_TRANSACTION_RECEIPT_POLLING_INTERVAL_IN_MS = 5_000L
168172
internal const val GET_TRANSACTION_RECEIPT_POLLING_ATTEMPTS = 60
173+
private val logger = KotlinLogging.logger {}
169174
}
170175
}

0 commit comments

Comments
 (0)