| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Control.Eff.LogWriter.File
Description
This helps to setup logging to a file.
Synopsis
- withFileLogging :: (Lifted IO e, MonadBaseControl IO (Eff e), HasCallStack) => FilePath -> Text -> Facility -> LogPredicate -> LogMessageTextRenderer -> Eff (Logs ': (LogWriterReader ': e)) a -> Eff e a
- withFileLogWriter :: (IoLogging e, MonadBaseControl IO (Eff e), HasCallStack) => FilePath -> LogMessageTextRenderer -> Eff e b -> Eff e b
Documentation
Arguments
| :: (Lifted IO e, MonadBaseControl IO (Eff e), HasCallStack) | |
| => 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 |
| -> LogMessageTextRenderer | The |
| -> Eff (Logs ': (LogWriterReader ': e)) a | |
| -> Eff e a |
Enable logging to a file, with some LogMessage fields preset
as described in withRichLogging.
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 renderLogMessageConsoleLog
$ logInfo "Oh, hi there"To vary the LogWriter use withRichLogging.
Arguments
| :: (IoLogging e, MonadBaseControl IO (Eff e), HasCallStack) | |
| => FilePath | Path to the log-file. |
| -> LogMessageTextRenderer | |
| -> 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
$ withoutLogging
$ withFileLogWriter "test.log" renderLogMessageConsoleLog
$ logInfo "Oh, hi there"