MokkeryCallLogger

class MokkeryCallLogger(lineTransformer: (String) -> String = { it }, loggingFunction: (String) -> Unit = ::println) : MokkeryCallListener

Logs each mock call with loggingFunction. By default, the loggingFunction is println.

Log line can be changed using lineTransformer.

To enable the logger, it has to be registered in a hook.

Example:

MokkeryCallInterceptor
.beforeAnswering
.register(MokkeryCallLogger())

Constructors

Link copied to clipboard
constructor(lineTransformer: (String) -> String = { it }, loggingFunction: (String) -> Unit = ::println)

Functions

Link copied to clipboard
open suspend override fun intercept(scope: MokkerySuspendCallScope): Any?

Do not override this method to keep MokkeryCallListener behaviour as intended.

Link copied to clipboard
open override fun onIntercept(scope: MokkeryCallScope)