Commit 409cdf6d authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Add additional logging!

parent 4a5e73b4
Pipeline #27692 passed with stages
in 3 minutes and 28 seconds
......@@ -47,6 +47,9 @@ class Service(file: String = "app.yml") {
val collector = ReportCollector(importApiUrl)
fun run() {
log.info("Begin reading from topic ${settings.inputTopic} on kafka cluster.")
log.info("Sending aggregated reports to ${importApiUrl}.")
log.info("Reading the following steps: ${stepWhitelist.str()}")
while (true) {
consumer.consume()
.mapNotNull { klaxon.parse<IndexReport>(it.value()) }
......
package org.memobase
import org.apache.logging.log4j.LogManager
import java.io.File
import java.nio.charset.Charset
class StepWhitelist(path: String) {
private val log = LogManager.getLogger(this::class.java)
private val whitelist = File(path).readLines(Charset.defaultCharset())
fun check(step: String): Boolean {
return whitelist.contains(step)
return if (whitelist.contains(step)) {
log.info("Step $step is present in whitelist. Processing report.")
true
} else {
log.info("Step $step is not present in whitelist. Not processing.")
false
}
}
fun str(): String {
return whitelist.joinToString(", ")
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment