Composable Contravariant Comonadic Logging Library

Version on this page:
LTS Haskell 14.21:
Stackage Nightly 2020-01-25:
Latest on Hackage:

See all snapshots co-log-core appears in

MPL-2.0 licensed by Dmitrii Kovanikov
Maintained by Kowainik

Module documentation for

This version can be pinned in stack with:co-log-core-,3084


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:


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


Change log

co-log-core uses PVP Versioning. The change log is available on GitHub. — 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.


  • #38: Rename cbind to cmapM.

  • #37: Add base bounds.


  • Initially created.
Depends on 1 package(full list with versions):
Used by 1 package in lts-14.20(full list with versions):