From f160c50d184e3f75d2adc52b11258b7180b361f6 Mon Sep 17 00:00:00 2001 From: dankito Date: Wed, 18 Sep 2024 17:40:34 +0200 Subject: [PATCH] Added fints4k option appendFinTsMessagesToLog to easily configure if FinTS messages should get added to log --- .../client/fints4k/FinTs4kBankingClient.kt | 2 +- .../client/fints4k/FinTsClientOptions.kt | 2 ++ README.md | 20 ++++++++++++++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/FinTs4kBankingClient.kt b/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/FinTs4kBankingClient.kt index b4349ae0..ccd9e621 100644 --- a/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/FinTs4kBankingClient.kt +++ b/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/FinTs4kBankingClient.kt @@ -21,7 +21,7 @@ open class FinTs4kBankingClient( constructor(callback: BankingClientCallback) : this(FinTsClientConfiguration(), callback) constructor(options: FinTsClientOptions, callback: BankingClientCallback) - : this(FinTsClientConfiguration(net.codinux.banking.fints.config.FinTsClientOptions(options.collectMessageLog, false, options.removeSensitiveDataFromMessageLog, options.closeDialogs, options.version, options.productName)), callback) + : this(FinTsClientConfiguration(net.codinux.banking.fints.config.FinTsClientOptions(options.collectMessageLog, false, options.removeSensitiveDataFromMessageLog, options.appendFinTsMessagesToLog, options.closeDialogs, options.version, options.productName)), callback) protected open val mapper = FinTs4kMapper() diff --git a/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/FinTsClientOptions.kt b/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/FinTsClientOptions.kt index 9ec65fdc..03d855f3 100644 --- a/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/FinTsClientOptions.kt +++ b/FinTs4jBankingClient/src/commonMain/kotlin/net/codinux/banking/client/fints4k/FinTsClientOptions.kt @@ -24,6 +24,8 @@ data class FinTsClientOptions( */ val removeSensitiveDataFromMessageLog: Boolean = true, + val appendFinTsMessagesToLog: Boolean = false, + val closeDialogs: Boolean = true, val version: String = "1.0.0", // TODO: get version dynamically diff --git a/README.md b/README.md index b44e1a3c..d78799e2 100644 --- a/README.md +++ b/README.md @@ -167,4 +167,22 @@ fun updateAccountTransactions() { } } } -``` \ No newline at end of file +``` + +## Logging + +BankingClient and fints4k both use [klf](https://github.com/codinux-gmbh/klf), a logging facade for Kotlin (Multiplatform) +with appenders for all supported KMP platforms. +So logging works on all platforms out of the box. On JVM, if slf4j is on the classpath, logging can be configured with +any slf4j compatible logging backend (logback, log4j, JBoss Logging, ...). + +If you want to see all sent and received FinTS messages, set the log level of `net.codinux.banking.fints.log.MessageLogCollector` to `DEBUG`, either via: +- your logging framework (e.g. logback) +- klf: `net.codinux.log.LoggerFactory.getLogger("net.codinux.banking.fints.log.MessageLogCollector").level = LogLevel.Debug` +- `appendFinTsMessagesToLog` option: +```kotlin +val client = FinTs4kBankingClient(FinTsClientOptions(appendFinTsMessagesToLog = true), SimpleBankingClientCallback()) +``` +But be aware, in latter case if you create multiple FinTs4kBankingClient instances, the latest value of `appendFinTsMessagesToLog` +overrides the value of all previous FinTs4kBankingClient instances. As with all other options, this configures the logger's level globally, +so the latest configured log level value wins. \ No newline at end of file