All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.malliina.logback.fs2.DefaultFS2IOAppender.scala Maven / Gradle / Ivy

There is a newer version: 2.8.0
Show newest version
package com.malliina.logback.fs2

import cats.effect.{ContextShift, IO}
import ch.qos.logback.classic.spi.ILoggingEvent
import com.malliina.logback.fs2.DefaultFS2IOAppender.contextShift
import com.malliina.logback.{LogEvent, TimeFormatting}
import fs2.Stream

import scala.concurrent.ExecutionContext

object DefaultFS2IOAppender {
  implicit val contextShift: ContextShift[IO] = IO.contextShift(ExecutionContext.global)

  def apply(): DefaultFS2IOAppender = new DefaultFS2IOAppender()
}

class DefaultFS2IOAppender extends FS2IOAppender[ILoggingEvent] with TimeFormatting[ILoggingEvent] {
  val logEvents: Stream[IO, LogEvent] =
    source.map(e => LogEvent.fromLogbackEvent(e, format))
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy