Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit 9f64521

Browse files
authored
Merge pull request #137 from pitgull/file-logger
2 parents 70fac0c + 6bb2002 commit 9f64521

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

build.sbt

+6-7
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ ThisBuild / githubWorkflowPublish := Seq(WorkflowStep.Sbt(List("docker:publish")
5151

5252
Test / fork := true
5353

54-
missinglinkExcludedDependencies in ThisBuild += moduleFilter(
54+
ThisBuild / missinglinkExcludedDependencies += moduleFilter(
5555
organization = "org.slf4j",
5656
name = "slf4j-api"
5757
)
@@ -74,14 +74,14 @@ val commonSettings = List(
7474
"org.typelevel" %% "cats-effect" % "2.3.1",
7575
"org.typelevel" %% "cats-tagless-macros" % "0.12",
7676
"co.fs2" %% "fs2-core" % "2.5.0",
77-
"com.github.valskalla" %% "odin-core" % "0.10.0",
77+
"com.github.valskalla" %% "odin-core" % "0.11.0",
7878
"io.circe" %% "circe-core" % "0.13.0",
7979
"com.github.julien-truffaut" %% "monocle-macro" % "2.1.0",
8080
"com.disneystreaming" %% "weaver-framework" % "0.5.1" % Test,
8181
"com.disneystreaming" %% "weaver-scalacheck" % "0.5.1" % Test
8282
) ++ compilerPlugins,
8383
testFrameworks += new TestFramework("weaver.framework.TestFramework"),
84-
skip in publish := true
84+
publish / skip := true
8585
)
8686

8787
lazy val gitlab = project
@@ -103,7 +103,7 @@ lazy val gitlab = project
103103
lazy val core = project.settings(commonSettings).settings(name += "-core")
104104

105105
//workaround for docker not accepting + (the default separator in sbt-dynver)
106-
dynverSeparator in ThisBuild := "-"
106+
ThisBuild / dynverSeparator := "-"
107107

108108
val installDhallJson =
109109
ExecCmd(
@@ -151,10 +151,9 @@ lazy val pitgull =
151151
"io.circe" %% "circe-generic-extras" % "0.13.0",
152152
"io.estatico" %% "newtype" % "0.4.4",
153153
"io.scalaland" %% "chimney" % "0.6.1",
154-
"org.typelevel" %% "cats-mtl-core" % "0.7.1",
155154
"io.chrisdavenport" %% "cats-time" % "0.3.4",
156-
"com.github.valskalla" %% "odin-core" % "0.10.0",
157-
"com.github.valskalla" %% "odin-slf4j" % "0.10.0",
155+
"com.github.valskalla" %% "odin-core" % "0.11.0",
156+
"com.github.valskalla" %% "odin-slf4j" % "0.11.0",
158157
"io.github.vigoo" %% "prox" % "0.5.2"
159158
)
160159
)

src/main/scala/io/pg/Main.scala

+4-5
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,23 @@ import org.http4s.server.middleware
2626

2727
object Main extends IOApp {
2828

29-
def mkLogger[F[_]: ConcurrentEffect: Timer: ContextShift] = {
29+
def mkLogger[F[_]: ConcurrentEffect: Timer: ContextShift]: Resource[F, Logger[F]] = {
3030

3131
// is withMinimalLevel even working??
3232
val console = io.odin.consoleLogger[F](formatter = Formatter.colorful).withMinimalLevel(Level.Info).pure[Resource[F, *]]
3333

3434
val file = io
3535
.odin
3636
.asyncRollingFileLogger[F](
37-
// https://github.com/valskalla/odin/issues/229
3837
fileNamePattern = dateTime => show"/tmp/log/pitgull/pitgull-logs-${dateTime.toLocalDate}.txt",
3938
rolloverInterval = 1.day.some,
4039
maxFileSizeInBytes = (10L * 1024 * 1024 /* 10MB */ ).some,
4140
maxBufferSize = 10.some,
4241
formatter = Formatter.colorful,
4342
minLevel = Level.Debug
4443
)
45-
//todo
46-
console // |+| file
44+
45+
console |+| file
4746
}
4847
.evalTap { logger =>
4948
Sync[F].delay(OdinInterop.globalLogger.set(logger.mapK(Effect.toIOK).some))
@@ -79,7 +78,7 @@ object Main extends IOApp {
7978
_ <- mkServer[F](config.http, config.meta, resources.routes)
8079
_ <- resources.background.parTraverse_(_.run).background
8180
_ <- logStarted(config.meta).resource_
82-
} yield resources.background
81+
} yield ()
8382

8483
def run(args: List[String]): IO[ExitCode] =
8584
AppConfig

0 commit comments

Comments
 (0)