6

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?

Jakob Odersky
  • 1,371
  • 11
  • 23

1 Answers1

8
sLog.value.warn("danger!")

sLog is a SettingKey[Logger] for use from setting initialization.

pfn
  • 1,820
  • 12
  • 11