polysemy-log-0.4.0.0: Polysemy Effects for Logging
Safe HaskellNone
LanguageHaskell2010

Polysemy.Log.Conc

Description

 
Synopsis

Documentation

interceptDataLogConcWithLocal :: forall msg r a. Members [Queue msg, DataLog msg] r => (msg -> msg) -> Sem r a -> Sem r a Source #

Intercept DataLog for concurrent processing. This does not send any action to the ultimate interpreter but writes all log messages to the provided queue. Local has to be handled here, otherwise this will not be called for actions in higher-order thunks.

interceptDataLogConcWith :: forall msg r a. Members [Queue msg, DataLog msg] r => Sem r a -> Sem r a Source #

Intercept DataLog for concurrent processing.

loggerThread :: forall msg r. Members [Queue msg, DataLog msg] r => Sem r () Source #

Part of interceptDataLogConc. Loop as long as the proided queue is open and relay all dequeued messages to the ultimate interpreter, thereby forcing the logging implementation to work in this thread.

interceptDataLogConc Source #

Arguments

:: forall msg r a. Members [DataLog msg, Resource, Async, Race, Embed IO] r 
=> Int

Queue size. When the queue fills up, the interceptor will block.

-> Sem r a 
-> Sem r a 

Intercept DataLog for concurrent processing. Creates a queue and starts a worker thread. All log messages received by the interceptor in interceptDataLogConcWithLocal are written to the queue and sent to the next DataLog interpreter when the thread reads from the queue.

Since this is an interceptor, it will not remove the effect from the stack, but relay it to another interpreter:

interpretDataLogAtomic (interceptDataLogConc 64 (DataLog.dataLog "message"))