A logging framework for Haskell
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src/System/Logging/LogSink
test
.ghci
.gitignore
.travis.yml
LICENSE
README.lhs
README.md
Setup.lhs
logsink.cabal
package.yaml

README.md

logsink

logsink is meant to be used in conjunction with logging-facade. To log messages application code uses functions from System.Logging.Facade. logsink itself is a backend for logging-facade and allows to configure logging behavior.

logsink has built-in support for stderr and syslog. The following example shows how to direct log messages to syslog:

import qualified System.Logging.Facade as Log
import           System.Logging.LogSink.Config

main :: IO ()
main = do
  setupLogging [defaultSinkConfig { sinkConfigTarget = SysLog }]
  Log.error "This is an error message."

You can also configure the message format. (See documentation of System.Logging.LogSink.Format for allowed format directives.)

main2 :: IO ()
main2 = do
  setupLogging [defaultSinkConfig { sinkConfigFormat = "{level} - {timestamp}: {message}" }]
  Log.error "This is an error message."