Safe Haskell | None |
---|---|
Language | Haskell2010 |
Enrich LogMessage
s with timestamps and OS dependent information.
Synopsis
- richLogWriter :: Text -> Facility -> LogWriter -> LogWriter
- withRichLogging :: Lifted IO e => LogWriter -> Text -> Facility -> LogPredicate -> Eff (Logs ': (LogWriterReader ': e)) a -> Eff e a
- stdoutLogWriter :: LogMessageRenderer Text -> IO LogWriter
Documentation
:: Text | The default application name to put into the |
-> Facility | The default RFC-5424 facility to put into the |
-> LogWriter | The IO based writer to decorate |
-> LogWriter |
Decorate an IO based LogWriter
to fill out these fields in LogMessage
s:
- 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 givenFacility
It works by using mappingLogWriterIO
.
:: Lifted IO e | |
=> LogWriter | The |
-> 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 ': 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