module Polysemy.Log.Stderr where
import qualified Data.Text.IO as Text
import Polysemy.Async (Async)
import Polysemy.Conc (Race)
import Polysemy.Resource (Resource)
import Polysemy.Time (GhcTime, interpretTimeGhc)
import Polysemy.Log.Data.DataLog (DataLog)
import Polysemy.Log.Data.Log (Log)
import Polysemy.Log.Data.LogEntry (LogEntry)
import Polysemy.Log.Data.LogMessage (LogMessage)
import Polysemy.Log.Data.Severity (Severity)
import Polysemy.Log.Format (formatLogEntry)
import Polysemy.Log.Level (setLogLevel)
import Polysemy.Log.Log (interpretDataLog, interpretLogDataLog, interpretLogDataLogConc)
interpretDataLogStderrWith ::
Member (Embed IO) r =>
(a -> Text) ->
InterpreterFor (DataLog a) r
interpretDataLogStderrWith :: forall (r :: EffectRow) a.
Member (Embed IO) r =>
(a -> Text) -> InterpreterFor (DataLog a) r
interpretDataLogStderrWith a -> Text
fmt =
(a -> Sem r ()) -> InterpreterFor (DataLog a) r
forall a (r :: EffectRow).
(a -> Sem r ()) -> InterpreterFor (DataLog a) r
interpretDataLog \ a
msg -> IO () -> Sem r ()
forall (m :: * -> *) (r :: EffectRow) a.
Member (Embed m) r =>
m a -> Sem r a
embed (Handle -> Text -> IO ()
Text.hPutStrLn Handle
stderr (a -> Text
fmt a
msg))
{-# inline interpretDataLogStderrWith #-}
interpretDataLogStderr ::
Show a =>
Member (Embed IO) r =>
InterpreterFor (DataLog a) r
interpretDataLogStderr :: forall a (r :: EffectRow).
(Show a, Member (Embed IO) r) =>
InterpreterFor (DataLog a) r
interpretDataLogStderr =
(a -> Text) -> InterpreterFor (DataLog a) r
forall (r :: EffectRow) a.
Member (Embed IO) r =>
(a -> Text) -> InterpreterFor (DataLog a) r
interpretDataLogStderrWith a -> Text
forall b a. (Show a, IsString b) => a -> b
show
{-# inline interpretDataLogStderr #-}
interpretLogStderrWith ::
Members [Embed IO, GhcTime] r =>
(LogEntry LogMessage -> Text) ->
InterpreterFor Log r
interpretLogStderrWith :: forall (r :: EffectRow).
Members '[Embed IO, GhcTime] r =>
(LogEntry LogMessage -> Text) -> InterpreterFor Log r
interpretLogStderrWith LogEntry LogMessage -> Text
fmt =
(LogEntry LogMessage -> Text)
-> InterpreterFor (DataLog (LogEntry LogMessage)) r
forall (r :: EffectRow) a.
Member (Embed IO) r =>
(a -> Text) -> InterpreterFor (DataLog a) r
interpretDataLogStderrWith LogEntry LogMessage -> Text
fmt (Sem (DataLog (LogEntry LogMessage) : r) a -> Sem r a)
-> (Sem (Log : r) a -> Sem (DataLog (LogEntry LogMessage) : r) a)
-> Sem (Log : r) a
-> Sem r a
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
Sem (GhcTime : DataLog (LogEntry LogMessage) : r) a
-> Sem (DataLog (LogEntry LogMessage) : r) a
forall (r :: EffectRow).
Member (Embed IO) r =>
InterpreterFor GhcTime r
interpretTimeGhc (Sem (GhcTime : DataLog (LogEntry LogMessage) : r) a
-> Sem (DataLog (LogEntry LogMessage) : r) a)
-> (Sem (Log : r) a
-> Sem (GhcTime : DataLog (LogEntry LogMessage) : r) a)
-> Sem (Log : r) a
-> Sem (DataLog (LogEntry LogMessage) : r) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
Sem (Log : GhcTime : DataLog (LogEntry LogMessage) : r) a
-> Sem (GhcTime : DataLog (LogEntry LogMessage) : r) a
forall (r :: EffectRow).
Members '[DataLog (LogEntry LogMessage), GhcTime] r =>
InterpreterFor Log r
interpretLogDataLog (Sem (Log : GhcTime : DataLog (LogEntry LogMessage) : r) a
-> Sem (GhcTime : DataLog (LogEntry LogMessage) : r) a)
-> (Sem (Log : r) a
-> Sem (Log : GhcTime : DataLog (LogEntry LogMessage) : r) a)
-> Sem (Log : r) a
-> Sem (GhcTime : DataLog (LogEntry LogMessage) : r) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
Sem (Log : r) a
-> Sem (Log : GhcTime : DataLog (LogEntry LogMessage) : r) a
forall (e2 :: Effect) (e3 :: Effect) (e1 :: Effect)
(r :: EffectRow) a.
Sem (e1 : r) a -> Sem (e1 : e2 : e3 : r) a
raiseUnder2
{-# inline interpretLogStderrWith #-}
interpretLogStderrLevelWith ::
Members [Embed IO, GhcTime] r =>
(LogEntry LogMessage -> Text) ->
Maybe Severity ->
InterpreterFor Log r
interpretLogStderrLevelWith :: forall (r :: EffectRow).
Members '[Embed IO, GhcTime] r =>
(LogEntry LogMessage -> Text)
-> Maybe Severity -> InterpreterFor Log r
interpretLogStderrLevelWith LogEntry LogMessage -> Text
fmt Maybe Severity
level =
(LogEntry LogMessage -> Text)
-> InterpreterFor (DataLog (LogEntry LogMessage)) r
forall (r :: EffectRow) a.
Member (Embed IO) r =>
(a -> Text) -> InterpreterFor (DataLog a) r
interpretDataLogStderrWith LogEntry LogMessage -> Text
fmt (Sem (DataLog (LogEntry LogMessage) : r) a -> Sem r a)
-> (Sem (Log : r) a -> Sem (DataLog (LogEntry LogMessage) : r) a)
-> Sem (Log : r) a
-> Sem r a
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
Maybe Severity
-> Sem (DataLog (LogEntry LogMessage) : r) a
-> Sem (DataLog (LogEntry LogMessage) : r) a
forall (r :: EffectRow) a.
Member (DataLog (LogEntry LogMessage)) r =>
Maybe Severity -> Sem r a -> Sem r a
setLogLevel Maybe Severity
level (Sem (DataLog (LogEntry LogMessage) : r) a
-> Sem (DataLog (LogEntry LogMessage) : r) a)
-> (Sem (Log : r) a -> Sem (DataLog (LogEntry LogMessage) : r) a)
-> Sem (Log : r) a
-> Sem (DataLog (LogEntry LogMessage) : r) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
Sem (GhcTime : DataLog (LogEntry LogMessage) : r) a
-> Sem (DataLog (LogEntry LogMessage) : r) a
forall (r :: EffectRow).
Member (Embed IO) r =>
InterpreterFor GhcTime r
interpretTimeGhc (Sem (GhcTime : DataLog (LogEntry LogMessage) : r) a
-> Sem (DataLog (LogEntry LogMessage) : r) a)
-> (Sem (Log : r) a
-> Sem (GhcTime : DataLog (LogEntry LogMessage) : r) a)
-> Sem (Log : r) a
-> Sem (DataLog (LogEntry LogMessage) : r) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
Sem (Log : GhcTime : DataLog (LogEntry LogMessage) : r) a
-> Sem (GhcTime : DataLog (LogEntry LogMessage) : r) a
forall (r :: EffectRow).
Members '[DataLog (LogEntry LogMessage), GhcTime] r =>
InterpreterFor Log r
interpretLogDataLog (Sem (Log : GhcTime : DataLog (LogEntry LogMessage) : r) a
-> Sem (GhcTime : DataLog (LogEntry LogMessage) : r) a)
-> (Sem (Log : r) a
-> Sem (Log : GhcTime : DataLog (LogEntry LogMessage) : r) a)
-> Sem (Log : r) a
-> Sem (GhcTime : DataLog (LogEntry LogMessage) : r) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
Sem (Log : r) a
-> Sem (Log : GhcTime : DataLog (LogEntry LogMessage) : r) a
forall (e2 :: Effect) (e3 :: Effect) (e1 :: Effect)
(r :: EffectRow) a.
Sem (e1 : r) a -> Sem (e1 : e2 : e3 : r) a
raiseUnder2
{-# inline interpretLogStderrLevelWith #-}
interpretLogStderr ::
Members [Embed IO, GhcTime] r =>
InterpreterFor Log r
interpretLogStderr :: forall (r :: EffectRow).
Members '[Embed IO, GhcTime] r =>
InterpreterFor Log r
interpretLogStderr =
(LogEntry LogMessage -> Text) -> InterpreterFor Log r
forall (r :: EffectRow).
Members '[Embed IO, GhcTime] r =>
(LogEntry LogMessage -> Text) -> InterpreterFor Log r
interpretLogStderrWith LogEntry LogMessage -> Text
formatLogEntry
{-# inline interpretLogStderr #-}
interpretLogStderrLevel ::
Members [Embed IO, GhcTime] r =>
Maybe Severity ->
InterpreterFor Log r
interpretLogStderrLevel :: forall (r :: EffectRow).
Members '[Embed IO, GhcTime] r =>
Maybe Severity -> InterpreterFor Log r
interpretLogStderrLevel =
(LogEntry LogMessage -> Text)
-> Maybe Severity -> InterpreterFor Log r
forall (r :: EffectRow).
Members '[Embed IO, GhcTime] r =>
(LogEntry LogMessage -> Text)
-> Maybe Severity -> InterpreterFor Log r
interpretLogStderrLevelWith LogEntry LogMessage -> Text
formatLogEntry
{-# inline interpretLogStderrLevel #-}
interpretLogStderr' ::
Member (Embed IO) r =>
InterpreterFor Log r
interpretLogStderr' :: forall (r :: EffectRow).
Member (Embed IO) r =>
InterpreterFor Log r
interpretLogStderr' =
Sem (GhcTime : r) a -> Sem r a
forall (r :: EffectRow).
Member (Embed IO) r =>
InterpreterFor GhcTime r
interpretTimeGhc (Sem (GhcTime : r) a -> Sem r a)
-> (Sem (Log : r) a -> Sem (GhcTime : r) a)
-> Sem (Log : r) a
-> Sem r a
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
Sem (Log : GhcTime : r) a -> Sem (GhcTime : r) a
forall (r :: EffectRow).
Members '[Embed IO, GhcTime] r =>
InterpreterFor Log r
interpretLogStderr (Sem (Log : GhcTime : r) a -> Sem (GhcTime : r) a)
-> (Sem (Log : r) a -> Sem (Log : GhcTime : r) a)
-> Sem (Log : r) a
-> Sem (GhcTime : r) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
Sem (Log : r) a -> Sem (Log : GhcTime : r) a
forall (e2 :: Effect) (e1 :: Effect) (r :: EffectRow) a.
Sem (e1 : r) a -> Sem (e1 : e2 : r) a
raiseUnder
{-# inline interpretLogStderr' #-}
interpretLogStderrConc ::
Members [Resource, Async, Race, Embed IO] r =>
InterpreterFor Log r
interpretLogStderrConc :: forall (r :: EffectRow).
Members '[Resource, Async, Race, Embed IO] r =>
InterpreterFor Log r
interpretLogStderrConc =
Sem (GhcTime : r) a -> Sem r a
forall (r :: EffectRow).
Member (Embed IO) r =>
InterpreterFor GhcTime r
interpretTimeGhc (Sem (GhcTime : r) a -> Sem r a)
-> (Sem (Log : r) a -> Sem (GhcTime : r) a)
-> Sem (Log : r) a
-> Sem r a
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
(LogEntry LogMessage -> Text)
-> InterpreterFor (DataLog (LogEntry LogMessage)) (GhcTime : r)
forall (r :: EffectRow) a.
Member (Embed IO) r =>
(a -> Text) -> InterpreterFor (DataLog a) r
interpretDataLogStderrWith LogEntry LogMessage -> Text
formatLogEntry (Sem (DataLog (LogEntry LogMessage) : GhcTime : r) a
-> Sem (GhcTime : r) a)
-> (Sem (Log : r) a
-> Sem (DataLog (LogEntry LogMessage) : GhcTime : r) a)
-> Sem (Log : r) a
-> Sem (GhcTime : r) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
Int
-> InterpreterFor Log (DataLog (LogEntry LogMessage) : GhcTime : r)
forall (r :: EffectRow).
Members
'[DataLog (LogEntry LogMessage), Resource, Async, Race, Embed IO]
r =>
Int -> InterpreterFor Log r
interpretLogDataLogConc Int
64 (Sem (Log : DataLog (LogEntry LogMessage) : GhcTime : r) a
-> Sem (DataLog (LogEntry LogMessage) : GhcTime : r) a)
-> (Sem (Log : r) a
-> Sem (Log : DataLog (LogEntry LogMessage) : GhcTime : r) a)
-> Sem (Log : r) a
-> Sem (DataLog (LogEntry LogMessage) : GhcTime : r) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
Sem (Log : r) a
-> Sem (Log : DataLog (LogEntry LogMessage) : GhcTime : r) a
forall (e2 :: Effect) (e3 :: Effect) (e1 :: Effect)
(r :: EffectRow) a.
Sem (e1 : r) a -> Sem (e1 : e2 : e3 : r) a
raiseUnder2
{-# inline interpretLogStderrConc #-}
interpretLogStderrLevelConc ::
Members [Resource, Async, Race, Embed IO] r =>
Maybe Severity ->
InterpreterFor Log r
interpretLogStderrLevelConc :: forall (r :: EffectRow).
Members '[Resource, Async, Race, Embed IO] r =>
Maybe Severity -> InterpreterFor Log r
interpretLogStderrLevelConc Maybe Severity
level =
Sem (GhcTime : r) a -> Sem r a
forall (r :: EffectRow).
Member (Embed IO) r =>
InterpreterFor GhcTime r
interpretTimeGhc (Sem (GhcTime : r) a -> Sem r a)
-> (Sem (Log : r) a -> Sem (GhcTime : r) a)
-> Sem (Log : r) a
-> Sem r a
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
(LogEntry LogMessage -> Text)
-> InterpreterFor (DataLog (LogEntry LogMessage)) (GhcTime : r)
forall (r :: EffectRow) a.
Member (Embed IO) r =>
(a -> Text) -> InterpreterFor (DataLog a) r
interpretDataLogStderrWith LogEntry LogMessage -> Text
formatLogEntry (Sem (DataLog (LogEntry LogMessage) : GhcTime : r) a
-> Sem (GhcTime : r) a)
-> (Sem (Log : r) a
-> Sem (DataLog (LogEntry LogMessage) : GhcTime : r) a)
-> Sem (Log : r) a
-> Sem (GhcTime : r) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
Maybe Severity
-> Sem (DataLog (LogEntry LogMessage) : GhcTime : r) a
-> Sem (DataLog (LogEntry LogMessage) : GhcTime : r) a
forall (r :: EffectRow) a.
Member (DataLog (LogEntry LogMessage)) r =>
Maybe Severity -> Sem r a -> Sem r a
setLogLevel Maybe Severity
level (Sem (DataLog (LogEntry LogMessage) : GhcTime : r) a
-> Sem (DataLog (LogEntry LogMessage) : GhcTime : r) a)
-> (Sem (Log : r) a
-> Sem (DataLog (LogEntry LogMessage) : GhcTime : r) a)
-> Sem (Log : r) a
-> Sem (DataLog (LogEntry LogMessage) : GhcTime : r) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
Int
-> InterpreterFor Log (DataLog (LogEntry LogMessage) : GhcTime : r)
forall (r :: EffectRow).
Members
'[DataLog (LogEntry LogMessage), Resource, Async, Race, Embed IO]
r =>
Int -> InterpreterFor Log r
interpretLogDataLogConc Int
64 (Sem (Log : DataLog (LogEntry LogMessage) : GhcTime : r) a
-> Sem (DataLog (LogEntry LogMessage) : GhcTime : r) a)
-> (Sem (Log : r) a
-> Sem (Log : DataLog (LogEntry LogMessage) : GhcTime : r) a)
-> Sem (Log : r) a
-> Sem (DataLog (LogEntry LogMessage) : GhcTime : r) a
forall b c a. (b -> c) -> (a -> b) -> a -> c
.
Sem (Log : r) a
-> Sem (Log : DataLog (LogEntry LogMessage) : GhcTime : r) a
forall (e2 :: Effect) (e3 :: Effect) (e1 :: Effect)
(r :: EffectRow) a.
Sem (e1 : r) a -> Sem (e1 : e2 : e3 : r) a
raiseUnder2
{-# inline interpretLogStderrLevelConc #-}