Safe Haskell | None |
---|---|
Language | Haskell2010 |
This helps to setup logging to a file.
Synopsis
- withFileLogging :: (Lifted IO e, MonadBaseControl IO (Eff e)) => FilePath -> Text -> Facility -> LogPredicate -> Eff (Logs ': (LogWriterReader (Lift IO) ': e)) a -> Eff e a
- withFileLogWriter :: (LogIo e, MonadBaseControl IO (Eff e)) => FilePath -> Eff e b -> Eff e b
Documentation
:: (Lifted IO e, MonadBaseControl IO (Eff e)) | |
=> FilePath | Path to the log-file. |
-> Text | The default application name to put into the |
-> Facility | The default RFC-5424 facility to put into the |
-> LogPredicate | The inital predicate for log messages, there are some pre-defined in Control.Eff.Log.Message |
-> Eff (Logs ': (LogWriterReader (Lift 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
.
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"