Skip to content

Commit f3cee34

Browse files
author
paweliwanow
committed
Merge remote-tracking branch 'remotes/upstream/master'
2 parents b1d93cf + 3e948c0 commit f3cee34

File tree

11 files changed

+323
-99
lines changed

11 files changed

+323
-99
lines changed

.travis.yml

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,39 +2,14 @@ sudo: required
22
dist: trusty
33
language: scala
44
scala:
5-
- 2.11.8
6-
- 2.12.0-M5
7-
- 2.12.0-RC1
8-
- 2.12.0-RC2
9-
- 2.12.0
5+
- 2.11.11
6+
- 2.12.4
7+
- 2.13.0-M2
108
env:
119
- JDK=oraclejdk8
1210
- JDK=openjdk8
13-
- JDK=oraclejdk7
14-
- JDK=openjdk7
15-
addons:
16-
# https://github.com/travis-ci/travis-ci/issues/5227#issuecomment-165131913
17-
hosts:
18-
- scala-logging
19-
hostname: scala-logging
2011
before_script:
2112
- jdk_switcher use $JDK
22-
matrix:
23-
# scala 2.12 requires java 8
24-
exclude:
25-
- scala: 2.12.0-M5
26-
env: JDK=oraclejdk7
27-
- scala: 2.12.0-M5
28-
env: JDK=openjdk7
29-
- scala: 2.12.0-RC1
30-
env: JDK=oraclejdk7
31-
- scala: 2.12.0-RC1
32-
env: JDK=openjdk7
33-
- scala: 2.12.0-RC2
34-
env: JDK=oraclejdk7
35-
- scala: 2.12.0-RC2
36-
env: JDK=openjdk7
37-
- scala: 2.12.0
38-
env: JDK=oraclejdk7
39-
- scala: 2.12.0
40-
env: JDK=openjdk7
13+
script:
14+
- sbt "++ ${TRAVIS_SCALA_VERSION}!" test
15+
- git diff --exit-code # check scalariform

README.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ if (logger.isDebugEnabled) logger.debug(s"Some $expensive message!")
2323
A compatible logging backend is [Logback](http://logback.qos.ch), add it to your sbt build definition:
2424

2525
```scala
26-
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.1.7"
26+
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.2.3"
2727
```
2828

2929
If you are looking for a version compatible with Scala 2.10, check out Scala Logging 2.x.
@@ -34,12 +34,12 @@ Scala Logging is published to Sonatype OSS and Maven Central:
3434

3535
- Group id / organization: *com.typesafe.scala-logging*
3636
- Artifact id / name: *scala-logging*
37-
- Latest version is 3.5.0
37+
- Latest version is 3.7.2
3838

3939
Usage with SBT, adding a dependency to the latest version of Scala Logging to your sbt build definition file:
4040

4141
```scala
42-
libraryDependencies += "com.typesafe.scala-logging" %% "scala-logging" % "3.5.0"
42+
libraryDependencies += "com.typesafe.scala-logging" %% "scala-logging" % "3.7.2"
4343
```
4444

4545
## Using Scala Logging ##
@@ -124,6 +124,17 @@ def serviceMethod(implicit correlationId: CorrelationId): Future[Result] = {
124124

125125
### What's new?
126126

127+
#### 3.7.2
128+
- Make logger to consume args of type `Any` with slf4 interpolator.
129+
130+
#### 3.7.1
131+
- Remove @volatile from lazy logger, failing with strict compiler settings
132+
133+
##### 3.7.0
134+
- Deconstruct Scala's string interpolation into SLF4J string interpolation.
135+
136+
##### 3.6.0 - flawed release
137+
127138
##### 3.5.0
128139
- More Logger factory methods, bugfixes and upgrades, published for Scala 2.12.0-M5, 2.12.0-RC1, 2.12.0-RC2 and 2.12.0.
129140

@@ -137,6 +148,28 @@ def serviceMethod(implicit correlationId: CorrelationId): Future[Result] = {
137148
- SLF4J loggers and our Logger now survive serialization. By survive serialization, we mean that the
138149
deserialized logger instances are fully functional.
139150

151+
## String Interpolation
152+
It is idiomatic to use Scala's string interpolation `logger.error(s"log $value")` instead of SLF4J string interpolation `logger.error("log {}", value)`.
153+
However there are some tools (such as [Sentry](https://sentry.io)) that use the log message format as grouping key. Therefore they do not work well with
154+
Scala's string interpolation.
155+
156+
Scala Logging replaces simple string interpolations with their SLF4J counterparts like this:
157+
158+
```scala
159+
logger.error(s"my log message: $arg1 $arg2 $arg3")
160+
```
161+
162+
```scala
163+
logger.error("my log message: {} {} {}", arg1, arg2, arg3)
164+
```
165+
166+
This has no effect on behavior and performace should be comparable (depends on the underlying logging library).
167+
168+
### Limitations
169+
- Works only when string interpolation is directly used inside the logging statement. That is when the log message is static (available at compile time).
170+
- Works only for the `logger.<level>(message)` and `logger.<level>(marker, message)` logging methods. It does not work if you want to log an exception and
171+
use string interpolation too (this is a limitation of the SLF4J API).
172+
140173
## Line numbers in log message?
141174

142175
Using the [sourcecode](https://github.com/lihaoyi/sourcecode#logging) library, it's possible to add line number

project/Dependencies.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import sbt._
22

33
object Version {
4-
val logback = "1.1.7"
4+
val logback = "1.2.3"
55
val mockito = "1.10.19"
6-
val scala = "2.11.8"
7-
val crossScala = List(scala, "2.12.0-M5", "2.12.0-RC1", "2.12.0-RC2", "2.12.0")
8-
val scalaTest = "3.0.0"
9-
val slf4j = "1.7.21"
6+
val scala = "2.11.12"
7+
val crossScala = List(scala, "2.12.4", "2.13.0-M2")
8+
val scalaTest = "3.0.4"
9+
val slf4j = "1.7.25"
1010
}
1111

1212
object Library {

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=0.13.13
1+
sbt.version=1.1.0

project/plugins.sbt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
resolvers += Resolver.typesafeRepo("releases")
22

3-
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0")
3+
addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.1.0")
44

5-
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.6.0")
5+
addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.2")
66

7-
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.3")
7+
addSbtPlugin("com.github.gseitz" % "sbt-release" % "1.0.7")
88

9-
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.1")
9+
addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.9.2")
1010

11-
addSbtPlugin("com.scalapenos" % "sbt-prompt" % "1.0.0")
11+
addSbtPlugin("com.scalapenos" % "sbt-prompt" % "1.0.2")

scalariform.sbt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
22
import scalariform.formatter.preferences.{AlignSingleLineCaseStatements, DoubleIndentClassDeclaration}
33

4-
scalariformSettings
5-
64
ScalariformKeys.preferences := ScalariformKeys.preferences.value
75
.setPreference(AlignSingleLineCaseStatements, true)
86
.setPreference(AlignSingleLineCaseStatements.MaxArrowIndent, 100)

0 commit comments

Comments
 (0)