Add API response logging
This commit is contained in:
parent
75ccf1a0ed
commit
eed8277ed6
2 changed files with 16 additions and 1 deletions
|
@ -52,7 +52,7 @@ class CryptoPrices : AbstractModule() {
|
|||
|
||||
/**
|
||||
* Returns the cryptocurrency market price from
|
||||
* [Coinbase](https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-prices#get-spot-price).
|
||||
* [Coinbase](https://docs.cdp.coinbase.com/coinbase-app/docs/api-prices#get-spot-price).
|
||||
*/
|
||||
override fun commandResponse(channel: String, cmd: String, args: String, event: GenericMessageEvent) {
|
||||
if (CURRENCIES.isEmpty()) {
|
||||
|
|
|
@ -39,6 +39,9 @@ import net.thauvin.erik.crypto.CryptoPrice
|
|||
import net.thauvin.erik.mobibot.modules.CryptoPrices.Companion.currentPrice
|
||||
import net.thauvin.erik.mobibot.modules.CryptoPrices.Companion.getCurrencyName
|
||||
import net.thauvin.erik.mobibot.modules.CryptoPrices.Companion.loadCurrencies
|
||||
import org.junit.jupiter.api.BeforeAll
|
||||
import java.util.logging.ConsoleHandler
|
||||
import java.util.logging.Level
|
||||
import kotlin.test.Test
|
||||
|
||||
class CryptoPricesTest {
|
||||
|
@ -69,4 +72,16 @@ class CryptoPricesTest {
|
|||
assertThat(getCurrencyName("USD"), "USD").isEqualTo("United States Dollar")
|
||||
assertThat(getCurrencyName("EUR"), "EUR").isEqualTo("Euro")
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
@BeforeAll
|
||||
fun beforeAll() {
|
||||
with(CryptoPrice.logger) {
|
||||
addHandler(ConsoleHandler().apply { level = Level.FINE })
|
||||
level = Level.FINE
|
||||
useParentHandlers = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue