Skip to content

Commit

Permalink
Merge pull request #330 from tpolecat/log4cats-dotty
Browse files Browse the repository at this point in the history
enable log module for Scala 3
  • Loading branch information
tpolecat authored Apr 27, 2021
2 parents 0128680 + b477ff2 commit 1b33378
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 11 deletions.
14 changes: 9 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ lazy val lightstepGrpc = project
libraryDependencies ++= Seq(
"com.lightstep.tracer" % "tracer-grpc" % "0.30.3",
"io.grpc" % "grpc-netty" % "1.37.0",
"io.netty" % "netty-tcnative-boringssl-static" % "2.0.38.Final"
"io.netty" % "netty-tcnative-boringssl-static" % "2.0.39.Final"
)
)

Expand Down Expand Up @@ -266,13 +266,17 @@ lazy val log = crossProject(JSPlatform, JVMPlatform)
.settings(commonSettings)
.settings(crossProjectSettings)
.settings(
publish / skip := scalaVersion.value.startsWith("3."),
name := "natchez-log",
description := "Logging bindings for Natchez, using log4cats.",
libraryDependencies ++= Seq(
"io.circe" %%% "circe-core" % "0.13.0",
"io.chrisdavenport" %%% "log4cats-core" % "1.1.1",
).filterNot(_ => scalaVersion.value.startsWith("3."))
"io.circe" %%% "circe-core" % {
if (scalaVersion.value == scala30PreviousVersion) "0.14.0-M5"
else if (scalaVersion.value == scala30Version) "0.14.0-M6"
else "0.13.0"
},
"org.typelevel" %%% "log4cats-core" % "1.3.0",
"io.github.cquiroz" %%% "scala-java-time" % "2.2.2" % Test,
)
)
lazy val logJVM = log.jvm.dependsOn(coreJVM)
lazy val logJS = log.js.dependsOn(coreJS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ package log

import cats.effect.{ Resource, Sync }
import cats.syntax.functor._
import io.chrisdavenport.log4cats.Logger
import org.typelevel.log4cats.Logger
import io.circe.Json

object Log {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import io.circe.Json
import io.circe.Encoder
import io.circe.syntax._
import io.circe.JsonObject
import io.chrisdavenport.log4cats.Logger
import org.typelevel.log4cats.Logger
import java.net.URI

private[log] final case class LogSpan[F[_]: Sync: Logger](
Expand Down Expand Up @@ -79,7 +79,7 @@ private[log] final case class LogSpan[F[_]: Sync: Logger](
exitCase match {
case Completed => List("exit.case" -> "completed".asJson)
case Canceled => List("exit.case" -> "canceled".asJson)
case Error(ex: Fields) => exitFields(ex) ++ ex.fields.toList.map(_.map(_.asJson))
case Error(ex: Fields) => exitFields(ex) ++ ex.fields.toList.map { case (k, v) => (k, v.asJson) }
case Error(ex) => exitFields(ex)
}
} ++ fs ++ List("children" -> cs.reverse.map(Json.fromJsonObject).asJson)
Expand All @@ -91,8 +91,8 @@ private[log] final case class LogSpan[F[_]: Sync: Logger](
def traceId: F[Option[String]] =
traceUUID.toString.some.pure[F]

def spanId: F[Option[String]] =
sid.toString.some.pure[F]
def spanId: F[Option[String]] =
sid.toString.some.pure[F]

def traceUri: F[Option[URI]] = none.pure[F]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
package natchez
package log

import io.chrisdavenport.log4cats.Logger
import org.typelevel.log4cats.Logger
import cats.effect.Sync
import cats.effect.concurrent.Ref
import cats.syntax.all._
Expand Down

0 comments on commit 1b33378

Please sign in to comment.