Skip to content

Latest commit

 

History

History
35 lines (28 loc) · 1.42 KB

README.md

File metadata and controls

35 lines (28 loc) · 1.42 KB

log-effectful

Build Status Hackage Dependencies Stackage LTS Stackage Nightly

Adaptation of the log-base library for the effectful ecosystem.

Example

A sample usage for logging to both standard output and Elasticsearch:

{-# LANGUAGE OverloadedStrings #-}
module Main where

import Effectful
import Effectful.Log
import Log.Backend.ElasticSearch
import Log.Backend.StandardOutput

main :: IO ()
main = runEff $ do
  let config = defaultElasticSearchConfig
        { esServer = "http://localhost:9200"
        , esIndex  = "logs"
        }
  withStdOutLogger $ \stdoutLogger -> do
    withElasticSearchLogger config $ \esLogger -> do
      runLog "main" (stdoutLogger <> esLogger) defaultLogLevel $ do
        logInfo_ "Hi there"