extensible-effects-concurrent-0.32.0: Message passing concurrency as extensible-effect

Safe HaskellNone
LanguageHaskell2010

Control.Eff.LogWriter.Rich

Description

Enrich LogMessages with timestamps and OS dependent information.

Synopsis

Documentation

richLogWriter Source #

Arguments

:: Text

The default application name to put into the lmAppName field.

-> Facility

The default RFC-5424 facility to put into the lmFacility field.

-> LogWriter

The IO based writer to decorate

-> LogWriter 

Decorate an IO based LogWriter to fill out these fields in LogMessages:

  • The messages will carry the given application name in the lmAppName field.
  • The lmTimestamp field contains the UTC time of the log event
  • The lmHostname field contains the FQDN of the current host
  • The lmFacility field contains the given Facility

It works by using mappingLogWriterIO.

withRichLogging Source #

Arguments

:: Lifted IO e 
=> LogWriter

The LogWriter that will be used to write log messages.

-> Text

The default application name to put into the lmAppName field.

-> Facility

The default RFC-5424 facility to put into the lmFacility field.

-> LogPredicate

The inital predicate for log messages, there are some pre-defined in Control.Eff.Log.Message

-> Eff (Logs ': (LogWriterReader ': e)) a 
-> Eff e a 

Enable logging to IO using the richLogWriter.

Example:

exampleWithIoLogging :: IO ()
exampleWithIoLogging =
    runLift
  $ withRichLogging debugTraceLogWriter
                  "my-app"
                  local7
                  (lmSeverityIsAtLeast informationalSeverity)
  $ logInfo "Oh, hi there"

stdoutLogWriter :: LogMessageRenderer Text -> IO LogWriter Source #

Render a LogMessage to stdout.

This function will also set the BufferMode of stdout to LineBuffering.

See ioHandleLogWriter.

Since: 0.31.0