co-log-core

Composable Contravariant Comonadic Logging Library

https://github.com/kowainik/co-log

Version on this page:0.2.0.0
LTS Haskell 22.14:0.3.2.1
Stackage Nightly 2024-03-29:0.3.2.1
Latest on Hackage:0.3.2.1

See all snapshots co-log-core appears in

MPL-2.0 licensed by Dmitrii Kovanikov
Maintained by Kowainik
This version can be pinned in stack with:co-log-core-0.2.0.0@sha256:ca2368435e7516df08f928c6be99e44f1574139d97ece023fab0d8de72d95b12,3084

Module documentation for 0.2.0.0

Depends on 1 package(full list with versions):
Used by 1 package in nightly-2019-09-12(full list with versions):

co-log

MPL-2.0 license Build status

co-log-core Hackage Stackage LTS Stackage Nightly
co-log Hackage Stackage LTS Stackage Nightly
co-log-polysemy Hackage Stackage LTS Stackage Nightly

co-log is a composable and configurable logging framework. The idea of the approach is described in the following blog post:

The repository contains the following packages:

  • co-log-core: lightweight package with basic data types and general idea.
  • co-log: taggless final implementation of logging library based on co-log-core.
  • co-log-polysemy: implementation of logging library based on co-log-core and the polysemy extensible effects library.
  • co-log-benchmark: Benchmarks of the co-log library.

See the following tutorial series about the library:

Benchmarks

co-log is compared with basic functions like putStrLn. Since IO overhead is big enough, every benchmark dumps 10K messages to output. If benchmark name doesn’t contain Message then this benchmark simply dumps string "message" to output, otherwise it works with Message data type from the co-log library.

Benchmarks Time for 10K messages
Prelude.putStrLn 5.117ms
Text.putStrLn 9.220ms
ByteString.putStrLn 2.971ms
mempty 1.181ms
logStringStdout 5.107ms
logPrint 5.248ms
logTextStdout 5.351ms
logByteStringStdout 2.933ms
logByteStringStderr 17.482ms
ByteString > (stdout <> stderr) 17.715ms
Message > format > stdout 9.188ms
Message > format > ByteString > stdout 3.524ms
Message{callstack} > format > stdout 9.139ms
Message{callstack:5} > format > stdout 9.464ms
Message{callstack:50} > format > stdout 9.439ms
Message{Time,ThreadId} > format > stdout 54.160ms
Message{Time,ThreadId} > format > ByteString > stdout 54.137ms

Changes

Change log

co-log-core uses PVP Versioning. The change log is available on GitHub.

0.1.2.0 — May 5, 2019

  • #85: Move overLogAction to HasLog typeclass
  • #101: Add logActionL lens with default implementation to HasLog type class.
  • #99: Add comonadic combinators: duplicate and multiplicate.
  • #78: Improve documentation significantly.

0.1.1 — Nov 15, 2018

  • #63: Add logPrint, logPrintStderr, logPrintHandle and withLogPrintFile to Colog.Core.IO.
  • #46: Moves logStringStdout, logStringStderr, logStringHandle, withLogStringFile from Colog.Actions to Colog.Core.IO.
  • #48: Adds liftLogIO function.
  • #49: Add <& and &>operators for unLogAction.
  • #47: Add doctest tests.
  • #13: Add .cabal file description and improve documentation.
  • #39: Support GHC-8.2.2 and GHC-8.6.2.

0.1.0

  • #38: Rename cbind to cmapM.

  • #37: Add base bounds.

0.0.0

  • Initially created.