zilog-over-sfl4j

SLF4J backend for Zilog

License

License

GroupId

GroupId

com.github.mvv.zilog
ArtifactId

ArtifactId

zilog-over-sfl4j_2.12
Last Version

Last Version

0.1-M8
Release Date

Release Date

Type

Type

jar
Description

Description

zilog-over-sfl4j
SLF4J backend for Zilog
Project URL

Project URL

https://github.com/mvv/zilog
Project Organization

Project Organization

com.github.mvv.zilog
Source Code Management

Source Code Management

https://github.com/mvv/zilog

Download zilog-over-sfl4j_2.12

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.mvv.zilog/zilog-over-sfl4j_2.12/ -->
<dependency>
    <groupId>com.github.mvv.zilog</groupId>
    <artifactId>zilog-over-sfl4j_2.12</artifactId>
    <version>0.1-M8</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.mvv.zilog/zilog-over-sfl4j_2.12/
implementation 'com.github.mvv.zilog:zilog-over-sfl4j_2.12:0.1-M8'
// https://jarcasting.com/artifacts/com.github.mvv.zilog/zilog-over-sfl4j_2.12/
implementation ("com.github.mvv.zilog:zilog-over-sfl4j_2.12:0.1-M8")
'com.github.mvv.zilog:zilog-over-sfl4j_2.12:jar:0.1-M8'
<dependency org="com.github.mvv.zilog" name="zilog-over-sfl4j_2.12" rev="0.1-M8">
  <artifact name="zilog-over-sfl4j_2.12" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.mvv.zilog', module='zilog-over-sfl4j_2.12', version='0.1-M8')
)
libraryDependencies += "com.github.mvv.zilog" % "zilog-over-sfl4j_2.12" % "0.1-M8"
[com.github.mvv.zilog/zilog-over-sfl4j_2.12 "0.1-M8"]

Dependencies

compile (3)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.12.11
com.github.mvv.zilog : zilog_2.12 jar 0.1-M8
org.slf4j : slf4j-api jar 1.7.30

provided (1)

Group / Artifact Type Version
dev.zio : zio_2.12 jar 1.0.0-RC19-2

Project Modules

There are no modules declared in this project.

Zilog

Release Version Snapshot Version Build Status

Structured logging library for ZIO

Using Zilog in your project

Add Zilog to your dependencies

libraryDependencies += "com.github.mvv.zilog" %% "zilog" % "0.1-M11"

If you plan to use custom compound structured arguments (like in the example below), you might want to also add sredded-generic dependency for the deriveStructured macro:

libraryDependencies += "com.github.mvv.sredded" %% "sredded-generic" % "0.1-M2" % Provided

Running the following example program

import com.github.mvv.sredded.StructuredMapping
import com.github.mvv.sredded.generic.deriveStructured
import com.github.mvv.zilog._
import zio.{App, ZEnv, ZIO}

final case class Request(src: String, method: String, path: String)
object Request {
  implicit val structured: StructuredMapping[Request] = deriveStructured
}

object RequestKey extends Logging.Key[Request]("request")
object CorrelationIdKey extends Logging.Key[String]("correlationId")
object CustomerIdKey extends Logging.Key[Long]("customerId")

object LoggingApp extends App {
  implicit val logger: Logger = Logger[LoggingApp.type]
  override def run(args: List[String]): ZIO[ZEnv, Nothing, Int] =
    {
      log.withLogArgs(RequestKey(Request("src", "GET", "/foo")), CorrelationIdKey("someId")) {
        log.info("Logic go brrrrr", CustomerIdKey(123))
      }
    } .provideCustomLayer(Logging.consoleJson()).as(0)
}

should produce something like (as a single line)

{
  "timestamp": "2020-05-01T00:00:00.000Z",
  "fiberId": "#0",
  "logger": "LoggingApp$",
  "level": "INFO",
  "message": "Logic go brrrrr",
  "args": {
    "request": {
      "src": "src",
      "method": "GET",
      "path": "/foo"
    },
    "correlationId": "someId",
    "customerId": 123
  },
  "stackTrace": null,
  "sourceFile": "LoggingApp.scala",
  "sourceClass": "LoggingApp",
  "sourceMethod": "run",
  "sourceLine": 20
}

Submodules

  • zilog-sager allows you to access Logging instances in Sager environments
  • zilog-over-slf4j provides a Logging service that uses SLF4J as a backend

Versions

Version
0.1-M8
0.1-M7
0.1-M6
0.1-M5
0.1-M4