I am trying to print a warning message whilst configuring an sbt setting. My initial attempt looks something like this:
setting := {
val log = streams.value.log
val condition = //check something
if (condition) {
log.warn("Warning, condition! Specific functionality may not work.")
//some default
} else {
//something else
}
}
However, since streams
is a TaskKey, its value can only be accessed from tasks. Furthermore, my setting is reused by other settings therefore I don't have the option of defining it as a task.
Hence my question: what is the best way to print warnings during setting initialization?
sLog.value.warn("danger!")
sLog
is a SettingKey[Logger]
for use from setting initialization.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With