Skip to content

Instantly share code, notes, and snippets.

@dacr
Last active May 25, 2024 10:19
Show Gist options
  • Save dacr/bf0786f20d1852f118ed677849443d3c to your computer and use it in GitHub Desktop.
Save dacr/bf0786f20d1852f118ed677849443d3c to your computer and use it in GitHub Desktop.
ZIO learning - using zio logging with logback / published by https://github.com/dacr/code-examples-manager #56c35fde-a141-49c2-8f0a-1053d1fe84d3/a5a228e9e2c270d3046996ce0b14fb266eeca66d
// summary : ZIO learning - using zio logging with logback
// keywords : scala, zio, learning, logging, pure-functional, @testable
// publish : gist
// authors : David Crosson
// license : Apache NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2)
// id : 56c35fde-a141-49c2-8f0a-1053d1fe84d3
// created-on : 2022-01-28T23:45:53+01:00
// managed-by : https://github.com/dacr/code-examples-manager
// run-with : scala-cli $file
// ---------------------
//> using scala "3.4.2"
//> using dep "dev.zio::zio:2.0.13"
//> using dep "dev.zio::zio-logging:2.1.12"
//> using dep "dev.zio::zio-logging-slf4j:2.1.12"
//> using dep "ch.qos.logback:logback-classic:1.4.7"
// ---------------------
import zio.*
import zio.logging.*
import zio.logging.backend.SLF4J
object Encapsulated extends ZIOAppDefault {
def run =
ZIO
.logInfo("Hello world")
.provide(removeDefaultLoggers, SLF4J.slf4j(format = LogFormat.colored))
}
Encapsulated.main(Array.empty)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment