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

Safe HaskellNone
LanguageHaskell2010

Control.Eff.LogWriter.File

Description

This helps to setup logging to a file.

Synopsis

Documentation

withFileLogging Source #

Arguments

:: (Lifted IO e, MonadBaseControl IO (Eff e)) 
=> FilePath

Path to the log-file.

-> 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 IO ': e)) a 
-> Eff e a 

Enable logging to a file, with some LogMessage fields preset as described in withIoLogging.

If the file or its directory does not exist, it will be created.

Example:

exampleWithFileLogging :: IO ()
exampleWithFileLogging =
    runLift
  $ withFileLogging "/var/log/my-app.log" "my-app" local7 allLogMessages
  $ logInfo "Oh, hi there"

To vary the LogWriter use withIoLogging.

withFileLogWriter Source #

Arguments

:: (Lifted IO e, LogsTo IO e, MonadBaseControl IO (Eff e)) 
=> FilePath

Path to the log-file.

-> Eff e b 
-> Eff e b 

Enable logging to a file.

If the file or its directory does not exist, it will be created. Example:

exampleWithFileLogWriter :: IO ()
exampleWithFileLogWriter =
    runLift
  $ withSomeLogging @IO
  $ withFileLogWriter "test.log"
  $ logInfo "Oh, hi there"