Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- interceptDataLogConcWithLocal :: forall msg r a. Members [Queue msg, DataLog msg] r => (msg -> msg) -> Sem r a -> Sem r a
- interceptDataLogConcWith :: forall msg r a. Members [Queue msg, DataLog msg] r => Sem r a -> Sem r a
- loggerThread :: forall msg r. Members [Queue msg, DataLog msg] r => Sem r ()
- finalize :: forall msg r. Members [Queue msg, Resource, Async, Race, Embed IO] r => Async (Maybe ()) -> Sem r ()
- interceptDataLogConc :: forall msg r a. Members [DataLog msg, Resource, Async, Race, Embed IO] r => Int -> Sem r a -> Sem r a
Documentation
interceptDataLogConcWithLocal :: forall msg r a. Members [Queue msg, DataLog msg] r => (msg -> msg) -> Sem r a -> Sem r a Source #
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 provided queue is open and relay all dequeued messages to the ultimate interpreter, thereby
forcing the logging implementation to work in this thread.
finalize :: forall msg r. Members [Queue msg, Resource, Async, Race, Embed IO] r => Async (Maybe ()) -> Sem r () Source #
Close the concurrent logger's queue and wait for one second to allow it to process any messages that have been queued.
:: 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"))