sbt-slf4j

An SLF4j backend that utilizes the SBT TaskStreams log.

License

License

Categories

Categories

SLF4J Application Layer Libs Logging
GroupId

GroupId

com.vast.sbt
ArtifactId

ArtifactId

sbt-slf4j
Last Version

Last Version

0.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

sbt-slf4j
An SLF4j backend that utilizes the SBT TaskStreams log.
Project URL

Project URL

https://github.com/vast-engineering
Project Organization

Project Organization

com.vast.sbt
Source Code Management

Source Code Management

https://github.com/vast-engineering/sbt-slf4j

Download sbt-slf4j

How to add to project

<!-- https://jarcasting.com/artifacts/com.vast.sbt/sbt-slf4j/ -->
<dependency>
    <groupId>com.vast.sbt</groupId>
    <artifactId>sbt-slf4j</artifactId>
    <version>0.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.vast.sbt/sbt-slf4j/
implementation 'com.vast.sbt:sbt-slf4j:0.2.0'
// https://jarcasting.com/artifacts/com.vast.sbt/sbt-slf4j/
implementation ("com.vast.sbt:sbt-slf4j:0.2.0")
'com.vast.sbt:sbt-slf4j:jar:0.2.0'
<dependency org="com.vast.sbt" name="sbt-slf4j" rev="0.2.0">
  <artifact name="sbt-slf4j" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.vast.sbt', module='sbt-slf4j', version='0.2.0')
)
libraryDependencies += "com.vast.sbt" % "sbt-slf4j" % "0.2.0"
[com.vast.sbt/sbt-slf4j "0.2.0"]

Dependencies

compile (2)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.10.4
org.slf4j : slf4j-api jar 1.7.7

provided (1)

Group / Artifact Type Version
org.scala-sbt » logging jar 0.13.5

Project Modules

There are no modules declared in this project.

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

...
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

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.

com.vast.sbt

Vast Engineering

Versions

Version
0.2.0