co-log-polysemy: Composable Contravariant Comonadic Logging Library

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

Warnings:

Implementation of the co-log logging based on the polysemy extensible effects library.

The ideas behind this package are described in the following blog post:

For the taggless final implementation of the co-log ideas se the following package:


[Skip to Readme]

Properties

Versions 0.0.0.0, 0.0.1.0, 0.0.1.1, 0.0.1.1, 0.0.1.2, 0.0.1.3, 0.0.1.4
Change log CHANGELOG.md
Dependencies base (>=4.10.1.0 && <4.14), co-log-core (>=0.2.0.0 && <0.3), co-log-polysemy, polysemy (>=1.2.0.0 && <1.4) [details]
License MPL-2.0
Copyright 2019-2020 Kowainik
Author Dmitrii Kovanikov
Maintainer Kowainik <xrom.xkov@gmail.com>
Category Logging, Contravariant, Comonad, Effects
Home page https://github.com/kowainik/co-log
Bug tracker https://github.com/kowainik/co-log/issues
Source repo head: git clone https://github.com/kowainik/co-log.git
Uploaded by shersh at 2020-02-18T18:46:04Z

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


Readme for co-log-polysemy-0.0.1.1

[back to package description]

co-log

Build status Windows build MPL-2.0 license

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. It combines all the benefits of Haskell idioms to provide a reasonable and convenient interface. Though it uses some advanced concepts in its core, we are striving to provide beginner-friendly API. The library also contains complete documentation with a lot of beginner-friendly examples, explanations and tutorials to guide users. The combination of pragmatic approach to logging and fundamental Haskell abstractions allows us to create highly composable and configurable logging framework.

If you're interested in how different Haskel typeclasses are used to implement core functions of co-log, you can read the following blog post which goes in detail about internal implementation specifics:

co-log is also modular on the level of packages. We care a lot about a low dependency footprint so you can build your logging only on top of the minimal required interface for your use-case. This repository contains the following packages:

To provide more user-friendly introduction to the library, we've created the tutorial series which introduces the main concepts behind co-log smoothly:

co-log also cares about concurrent logging. For this purposes we have the concurrent-playground executable where we experiment with different multithreading scenarios to test the library behavior. You can find it here:

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.

To run benchmarks, use the following command:

cabal v2-run co-log-bench
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