https://github.com/vast-engineering/sbt-slf4j
An SLF4j backend that utilizes the SBT log.
https://github.com/vast-engineering/sbt-slf4j
Last synced: 28 days ago
JSON representation
An SLF4j backend that utilizes the SBT log.
- Host: GitHub
- URL: https://github.com/vast-engineering/sbt-slf4j
- Owner: vast-engineering
- License: apache-2.0
- Created: 2014-07-07T15:45:21.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2016-03-29T16:37:56.000Z (about 10 years ago)
- Last Synced: 2025-01-13T19:48:11.596Z (over 1 year ago)
- Language: Scala
- Size: 168 KB
- Stars: 2
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[vast]: https://github.com/vast-engineering
[LICENSE]: LICENSE
sbt-slf4j
=========
This is an SLF4J backend that binds to an underlying SBT log.
To use this plugin, add the following to your build -
## project/plugins.sbt
```scala
...
libraryDependencies += "com.vast.sbt" %% "sbt-sl4fj" % "0.2.1"
...
```
In tasks that call out to libraries that use slf4j, wrap the task implementation with the following
```scala
import sbt._
import com.vast.sbtlogger.SbtLogger._
object SomeBuild {
lazy val someTaskKey = taskKey[Unit]("Does some sort of work")
lazy val someBuildSettings = Seq(
someTaskKey := {
withLogger(streams.value.log) {
...
//do some work
...
}
}
)
}
```
This will bind the task-scoped streams log to slf4j for the thread executing the task and any threads spawned from it.
Since SBT will close the stream after the task body itself finishes execution, it's your responsibility to ensure that
any spwaned threads complete before the main task body does - otherwise, you'll get an exception stating the
stream has already been closed.
license
-------
See [LICENSE].