polysemy-log-co-0.4.2.0: Colog Adapters for Polysemy-Log
Safe HaskellNone
LanguageHaskell2010

Polysemy.Log.Colog

Description

 
Synopsis

Introduction

This package is a co-log adapter for polysemy-log, providing interpreters that convert Log and DataLog into Log actions.

import Polysemy.Log
import Polysemy.Log.Colog

prog :: Member Log r => Sem r ()
prog = do
  Log.debug "debugging"
  Log.error "failing"

interpretLogColog prog :: Sem [Colog.Log (LogEntry LogMessage), Embed IO] ()
interpretLogStdout prog :: Sem '[Embed IO] ()

Interpreters

interpretLogStdout :: Member (Embed IO) r => InterpreterFor Log r Source #

Interpret Log fully in terms of Log, using the default message and stdout.

interpretLogStdoutConc :: Members [Resource, Async, Race, Embed IO] r => InterpreterFor Log r Source #

Like interpretLogStdout, but process messages concurrently.

interpretLogStdoutAsNative :: Member (Embed IO) r => InterpretersFor [Log, Log Message] r Source #

Interpret Log fully in terms of Log, using co-log's message protocol and stdout.

interpretLogColog :: Members [Log (LogEntry LogMessage), GhcTime] r => InterpreterFor Log r Source #

Reinterpret Log as Log, using the polysemy-log default message.

Since this adds a timestamp, it has a dependency on GhcTime. Use interpretLogColog' for a variant that interprets GhcTime in-place.

interpretLogColog' :: Members [Log (LogEntry LogMessage), Embed IO] r => InterpretersFor [Log, GhcTime] r Source #

Reinterpret Log as Log, also interpreting GhcTime.

interpretDataLogColog :: forall a r. Member (Log a) r => InterpreterFor (DataLog a) r Source #

Reinterpret DataLog as Log.

interpretCologConcNative :: Members [Resource, Embed IO] r => InterpreterFor (Log (LogEntry LogMessage)) r Source #

Interpret Log using co-log's concurrent logger with the default message and formatting.

interpretCologConcNativeWith :: forall msg r. Members [Resource, Embed IO] r => Capacity -> LogAction IO msg -> InterpreterFor (Log msg) r Source #

Interpret Log using co-log's concurrent logger with the provided LogAction.

interpretCologAtomic :: forall a r. Member (Embed IO) r => InterpretersFor [Log a, AtomicState [a]] r Source #

Interpret Log by prepending each message to a list in an AtomicState, then interpret the AtomicState in a TVar.

interpretCologAtomic' :: forall a r. Member (AtomicState [a]) r => InterpreterFor (Log a) r Source #

Interpret Log by prepending each message to a list in an AtomicState.