Skip to content

Commit

Permalink
Add logging for queries
Browse files Browse the repository at this point in the history
  • Loading branch information
kunyavskiy committed Jun 2, 2024
1 parent 6aec435 commit 21024e9
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import kotlinx.serialization.*
import kotlinx.serialization.json.Json
import org.icpclive.cds.settings.NetworkSettings
import org.icpclive.cds.settings.UrlOrLocalPath
import org.icpclive.cds.util.getLogger
import org.w3c.dom.Document
import java.io.File
import javax.xml.parsers.DocumentBuilder
Expand All @@ -17,6 +18,8 @@ public fun interface DataLoader<out T> {
public suspend fun load(): T

public companion object {
private val logger by getLogger()

private fun <T> impl(
networkSettings: NetworkSettings?,
auth: ClientAuth?,
Expand All @@ -30,6 +33,7 @@ public fun interface DataLoader<out T> {
when (val url = computeURL()) {
is UrlOrLocalPath.Local -> url.value.toFile().processFile()
is UrlOrLocalPath.Url -> wrapIfSSLError {
logger.debug { "Requesting ${url.value}" }
httpClient.request(url.value).processRequest()
}
}
Expand Down

0 comments on commit 21024e9

Please sign in to comment.