Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scrive/log
Structured logging solution.
https://github.com/scrive/log
haskell logging scrive
Last synced: about 2 months ago
JSON representation
Structured logging solution.
- Host: GitHub
- URL: https://github.com/scrive/log
- Owner: scrive
- License: bsd-3-clause
- Created: 2015-05-07T12:01:18.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-03-14T18:44:09.000Z (almost 2 years ago)
- Last Synced: 2024-04-25T23:31:23.962Z (8 months ago)
- Topics: haskell, logging, scrive
- Language: Haskell
- Homepage: https://hackage.haskell.org/package/log-base
- Size: 345 KB
- Stars: 31
- Watchers: 34
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# log
[![Hackage version](https://img.shields.io/hackage/v/log-base.svg?label=Hackage)](https://hackage.haskell.org/package/log-base)
[![Build Status](https://github.com/scrive/log/workflows/Haskell-CI/badge.svg?branch=master)](https://github.com/scrive/log/actions?query=branch%3Amaster)A set of libraries that provide a way to record structured log messages with
multiple backends.Supported backends:
* Standard output via
[`log-base`](https://hackage.haskell.org/package/log-base).
* Elasticsearch via
[`log-elasticsearch`](https://hackage.haskell.org/package/log-elasticsearch).
* PostgreSQL via
[`log-postgres`](https://hackage.haskell.org/package/log-postgres).## Example
A sample usage for logging to both standard output and Elasticsearch:
```haskell
{-# LANGUAGE OverloadedStrings #-}
module Main whereimport Log
import Log.Backend.ElasticSearch
import Log.Backend.StandardOutputmain :: 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"
```