mirror of https://github.com/sbt/sbt.git
[2.x] fix: Respect global log level in continuous build watcher (#8864)
**Problem**
Running `sbt -error ~run` still prints [info] messages from the watcher
("Monitoring source files...", "Build triggered by...", etc). The watcher
creates its logger using only the watchLogLevel setting (default Info),
ignoring the global log level set via CLI flags like -error or -warn.
**Solution**
In Continuous.getCallbacks, take the more restrictive of the watchLogLevel
and the global log level from State when configuring the watcher appender.
Fixes #7355
This commit is contained in:
parent
4ba457d5d1
commit
3579dd0a9f
|
|
@ -271,7 +271,9 @@ private[sbt] object Continuous {
|
|||
validateCommands(s, commands)
|
||||
val configs = getAllConfigs(s, commands, dynamicInputs)
|
||||
val appender = ConsoleAppender(channel.name + "-watch", channel.terminal)
|
||||
val level = configs.minBy(_.watchSettings.logLevel).watchSettings.logLevel
|
||||
val watchLevel = configs.minBy(_.watchSettings.logLevel).watchSettings.logLevel
|
||||
val globalLevel = s.get(Keys.logLevel.key).getOrElse(Level.Info)
|
||||
val level = Seq(watchLevel, globalLevel).max
|
||||
context.addAppender(channel.name + "-watch", appender -> level)
|
||||
aggregate(
|
||||
configs,
|
||||
|
|
|
|||
Loading…
Reference in New Issue