在 SBT 任务中logLevel
使用时streams.value.log
如何设置?
例如,如何将此任务的日志压缩为仅Warn
日志?:
lazy val mainRunner = taskKey[Seq[File]]("Runs a main method")
lazy val mainRunnerSetting = mainRunner := {
val logger = streams.value.log
(runner in Compile).value.run(
mainClass = "com.me.Main",
classpath = (dependencyClasspath in Compile).value.files,
log = logger,
options = Array()
)
}
在任务内外,我尝试了各种 logLevel 设置,例如:
logLevel in run in Compile := Level.Warn
logLevel := Level.Warn
logLevel in mainRunner := Level.Warn
logLevel in streams := Level.Warn
...但它总是设置为Info
这个任务执行的时间