A library that provides a way to record structured log messages with multiple backends. Supported backends: standard output Elasticsearch PostgreSQL


Keywords
benchmark, bsd3, library, test, Log, Log.Backend.ElasticSearch, Log.Backend.ElasticSearch.Internal, Log.Backend.ElasticSearch.Lens, Log.Backend.ElasticSearch.V1, Log.Backend.ElasticSearch.V1.Internal, Log.Backend.ElasticSearch.V1.Lens, Log.Backend.ElasticSearch.V5, Log.Backend.ElasticSearch.V5.Internal, Log.Backend.ElasticSearch.V5.Lens, Log.Backend.PostgreSQL, Log.Backend.StandardOutput, Log.Backend.StandardOutput.Bulk, Log.Backend.Text, Log.Class, Log.Data, Log.Internal.Logger, Log.Logger, Log.Monad, haskell, logging, scrive
License
BSD-3-Clause
Install
cabal install log-0.7

Documentation

log

Hackage version Build Status

A set of libraries that provide a way to record structured log messages with multiple backends.

Supported backends:

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"