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.
41 lines
1.3 KiB
41 lines
1.3 KiB
package nova.monadic_sfx
|
|
|
|
import scala.concurrent.duration._
|
|
|
|
import _root_.monix.bio.Task
|
|
import cats.implicits._
|
|
import io.odin._
|
|
import io.odin.config._
|
|
import io.odin.syntax._
|
|
import nova.monadic_sfx.actors.ActorModule
|
|
import nova.monadic_sfx.http.HttpModule
|
|
import nova.monadic_sfx.ui.UiModule
|
|
import nova.monadic_sfx.util.reactive.store.Middlewares
|
|
|
|
trait MainModule extends ActorModule with UiModule with HttpModule {
|
|
def routerLogger(defaultLogger: Logger[Task], storeLogger: Logger[Task]) =
|
|
enclosureRouting[Task](
|
|
"nova.monadic_sfx.util.reactive.store.Middlewares" -> storeLogger,
|
|
"nova.monadic_sfx.util.reactive.store.Store" -> storeLogger
|
|
)
|
|
.withFallback(defaultLogger)
|
|
.withAsync(timeWindow = 10.millis)
|
|
|
|
def makeLogger =
|
|
for {
|
|
defaultLogger <- consoleLogger[Task]()
|
|
.withAsync(timeWindow = 10.millis) |+| fileLogger[Task](
|
|
"application.log"
|
|
).withAsync(timeWindow = 10.millis)
|
|
middlewareLogger <-
|
|
consoleLogger[
|
|
Task
|
|
](formatter = Middlewares.format)
|
|
.withMinimalLevel(Level.Trace)
|
|
.withAsync(timeWindow = 10.millis) |+| fileLogger[Task](
|
|
"stores.log",
|
|
formatter = Middlewares.format
|
|
).withAsync(timeWindow = 10.millis)
|
|
routerLogger <- routerLogger(defaultLogger, middlewareLogger)
|
|
} yield (routerLogger)
|
|
}
|