https://github.com/haskell-effectful/log-effectful
https://github.com/haskell-effectful/log-effectful
effect-system effectful
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/haskell-effectful/log-effectful
- Owner: haskell-effectful
- License: mit
- Created: 2022-02-18T14:31:45.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-11-07T17:54:47.000Z (over 1 year ago)
- Last Synced: 2024-11-30T17:55:29.855Z (about 1 year ago)
- Topics: effect-system, effectful
- Language: Haskell
- Homepage:
- Size: 23.4 KB
- Stars: 9
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# log-effectful
[](https://github.com/haskell-effectful/log-effectful/actions?query=branch%3Amaster)
[](https://hackage.haskell.org/package/log-effectful)
[](https://packdeps.haskellers.com/feed?needle=andrzej@rybczak.net)
[](https://www.stackage.org/lts/package/log-effectful)
[](https://www.stackage.org/nightly/package/log-effectful)
Adaptation of the [log-base](https://hackage.haskell.org/package/log-base)
library for the effectful ecosystem.
## Example
A sample usage for logging to both standard output and Elasticsearch:
```haskell
{-# 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"
```