Skip to content

Commit

Permalink
Include line numbers in json printer
Browse files Browse the repository at this point in the history
  • Loading branch information
hejfelix committed Apr 27, 2022
1 parent 3c9638d commit 2a6a965
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ object JsonSupport:
"epochMillis" -> Json.fromLong(epochMillis.millis),
"timeStamp" -> Json.fromString(formattedTime),
"enclosingClass" -> Json.fromString(logLine.info.enclosingClass.fullName),
"lineNumber" -> Json.fromLong(logLine.info.lineNumber),
"message" -> Json.fromString(logLine.message),
"context" -> contextJson
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class JsonSupportFunSuite extends munit.FunSuite:
val js = JsonSupport
val actual = js.toJsonString(logLine, epochMillis)
val expected =
"""{"level":"Debug","epochMillis":549459420000,"timeStamp":"1987-05-31T11:37:00Z","enclosingClass":"my.enclosing.Class","message":"my message","context":{"hey":"dude","foo":"bar"}}"""
"""{"level":"Debug","epochMillis":549459420000,"timeStamp":"1987-05-31T11:37:00Z","enclosingClass":"my.enclosing.Class","lineNumber":1337,"message":"my message","context":{"hey":"dude","foo":"bar"}}"""

assertEquals(actual, expected)
}
Expand Down

0 comments on commit 2a6a965

Please sign in to comment.