log-base: Structured logging solution (base package)

[ bsd3, library, system ] [ Propose Tags ]

A library that provides a way to record structured log messages. Use this package in conjunction with 'log-elasticsearch' or 'log-postgres', depending on which back end you need.

[Skip to Readme]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Versions [RSS] 0.7, 0.7.1,,,,,,,,,,,,,,,
Change log CHANGELOG.md
Dependencies aeson (>=1.0), aeson-pretty (>=0.8.2), base (>=4.13 && <5), bytestring, deepseq, exceptions (>=0.6), mmorph (>=1.0.9 && <1.3), monad-control (>=1.0.3), mtl, semigroups, stm (>=2.4), text, time (>=1.5), transformers-base, unliftio-core (>= && <0.3), unordered-containers [details]
License BSD-3-Clause
Copyright Scrive AB
Author Scrive AB
Maintainer Andrzej Rybczak <andrzej@rybczak.net>, Jonathan Jouty <jonathan@scrive.com>, Mikhail Glushenkov <mikhail@scrive.com>, Oleg Grenrus <oleg.grenrus@iki.fi>
Category System
Home page https://github.com/scrive/log
Source repo head: git clone https://github.com/scrive/log.git
Uploaded by arybczak at 2023-03-14T18:42:02Z
Distributions LTSHaskell:, NixOS:, Stackage:
Reverse Dependencies 7 direct, 1 indirect [details]
Downloads 9586 total (78 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2023-03-14 [all 1 reports]

Readme for log-base-

[back to package description]


Hackage version Build Status

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

Supported backends:


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"