You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
package org.slf4j.impl
import cats.effect.{ContextShift, Clock, Effect, IO, Timer} import io.odin._ import io.odin.slf4j.OdinLoggerBinder
import scala.concurrent.ExecutionContext import _root_.monix.execution.Scheduler
//effect type should be specified inbefore
//log line will be recorded right after the call with no suspension
class StaticLoggerBinder extends OdinLoggerBinder[IO] {
val ec: ExecutionContext = Scheduler.global implicit val timer: Timer[IO] = IO.timer(ec) implicit val clock: Clock[IO] = timer.clock implicit val cs: ContextShift[IO] = IO.contextShift(ec) implicit val F: Effect[IO] = IO.ioEffect
val loggers: PartialFunction[String, Logger[IO]] = { case "some.external.package.SpecificClass" => consoleLogger[IO](minLevel = Level.Warn) //disable noisy external logs
case "org.asynchttpclient.netty.channel.DefaultChannelPool" => consoleLogger[IO](minLevel = Level.Warn) case _ => //if wildcard case isn't provided, default logger is no-op
consoleLogger[IO]() } }
object StaticLoggerBinder extends StaticLoggerBinder {
var REQUESTED_API_VERSION: String = "1.7"
def getSingleton: StaticLoggerBinder = this
}
|