@hackage log-postgres0.9.0.1
Structured logging solution (PostgreSQL back end)
Categories
License
BSD-3-Clause
Maintainer
Andrzej Rybczak <andrzej@rybczak.net>, Jonathan Jouty <jonathan@scrive.com>, Mikhail Glushenkov <mikhail@scrive.com>, Oleg Grenrus <oleg.grenrus@iki.fi>
Links
Versions
Deprecated
Tested Compilers
Dependencies (19)
- aeson >=1.0
- aeson-pretty >=0.8
- base >=4.13 && <5
- base64-bytestring >=1.0
- bytestring >=0.10
- deepseq >=1.4 Show all…
Dependents (1)
@hackage/log
log
A set of libraries that provide a way to record structured log messages with multiple backends.
Supported backends:
- Standard output via
log-base. - Elasticsearch via
log-elasticsearch. - PostgreSQL via
log-postgres.
Example
A sample usage for logging to both standard output and Elasticsearch:
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Log
import Log.Backend.ElasticSearch
import Log.Backend.StandardOutput
main :: IO ()
main = do
let config = defaultElasticSearchConfig
{ esServer = "http://localhost:9200"
, esIndex = "logs"
}
withStdOutLogger $ \stdoutLogger -> do
withElasticSearchLogger config $ \esLogger -> do
runLogT "main" (stdoutLogger <> esLogger) defaultLogLevel $ do
logInfo_ "Hi there"