Safe Haskell | None |
---|---|
Language | Haskell2010 |
This helps to setup logging to standard ouput.
Synopsis
- withConsoleLogWriter :: (LogsTo IO e, Lifted IO e) => Eff e a -> Eff e a
- withConsoleLogging :: Lifted IO e => Text -> Facility -> LogPredicate -> Eff (Logs ': (LogWriterReader IO ': e)) a -> Eff e a
- consoleLogWriter :: LogWriter IO
- stdoutLogWriter :: LogMessageRenderer Text -> LogWriter IO
Documentation
withConsoleLogWriter :: (LogsTo IO e, Lifted IO e) => Eff e a -> Eff e a Source #
Enable logging to standard output
using the consoleLogWriter
.
Log messages are rendered using renderLogMessageConsoleLog
.
Example:
exampleWithConsoleLogWriter :: IO () exampleWithConsoleLogWriter = runLift $ withSomeLogging @IO $ withConsoleLogWriter $ logInfo "Oh, hi there"
:: Lifted IO e | |
=> 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 IO ': e)) a | |
-> Eff e a |
Enable logging to standard output
using the consoleLogWriter
, with some LogMessage
fields preset
as in withIoLogging
.
Log messages are rendered using renderLogMessageConsoleLog
.
Example:
exampleWithConsoleLogging :: IO () exampleWithConsoleLogging = runLift $ withConsoleLogging "my-app" local7 allLogMessages $ logInfo "Oh, hi there"
To vary the LogWriter
use withIoLogging
.
consoleLogWriter :: LogWriter IO Source #
Write LogMessage
s to standard output, formatted with printLogMessage
.
It uses stdoutLogWriter
with renderLogMessageConsoleLog
.
stdoutLogWriter :: LogMessageRenderer Text -> LogWriter IO Source #
A LogWriter
that uses a LogMessageRenderer
to render, and putStrLn
to print it.