co-log-core: Composable Contravariant Comonadic Logging Library

[ comonad, contravariant, library, logging, mpl ] [ Propose Tags ]

This package provides core types and functions to work with the LogAction data type which is both simple and powerful.

newtype LogAction m msg = LogAction
    { unLogAction :: msg -> m ()
    }

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

See the following packages for different implementations based on co-log-core:

  • co-log: taggless final implementations.

  • co-log-polysemy: extensible effects implementation based on polysemy.


[Skip to Readme]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

Versions [RSS] 0.0.0, 0.1.0, 0.1.1, 0.2.0.0, 0.2.1.0, 0.2.1.1, 0.3.0.0, 0.3.1.0, 0.3.2.0, 0.3.2.1
Change log CHANGELOG.md
Dependencies base (>=4.10.1.0 && <4.19) [details]
License MPL-2.0
Copyright 2018-2020 Kowainik, 2021-2022 Co-Log
Author Dmitrii Kovanikov
Maintainer Kowainik <xrom.xkov@gmail.com>
Revised Revision 2 made by alaendle at 2023-09-17T09:07:04Z
Category Logging, Contravariant, Comonad
Home page https://github.com/co-log/co-log-core
Bug tracker https://github.com/co-log/co-log-core/issues
Source repo head: git clone https://github.com/co-log/co-log-core.git
Uploaded by vrom911 at 2022-11-02T18:14:47Z
Distributions Arch:0.3.2.1, LTSHaskell:0.3.2.1, NixOS:0.3.2.1, Stackage:0.3.2.1
Reverse Dependencies 23 direct, 58 indirect [details]
Downloads 7908 total (177 in the last 30 days)
Rating 2.25 (votes: 2) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2022-11-02 [all 1 reports]

Readme for co-log-core-0.3.2.0

[back to package description]

co-log-core

Co-logo

GitHub CI Hackage MPL-2.0 license

co-log-core is a lightweight package that provides core types and functions to work with the @LogAction@ data type which is both simple and powerful.

How to use

co-log-core is compatible with the following GHC versions - supported versions

In order to start using co-log-core in your project, you will need to set it up with these steps:

  1. Add the dependency on co-log-core in your project's .cabal file. For this, you should modify the build-depends section according to the below section:

    build-depends: base ^>= LATEST_SUPPORTED_BASE
                 , co-log-core ^>= LATEST_VERSION
    
  2. To use this package, refer to the below example.

    module Main (main) where
    
    import Prelude hiding (log)
    
    import Colog.Core (LogAction, logStringStdout, (<&))
    
    
    app :: LogAction IO String -> IO ()
    app log = do
        log <& "Starting app..."
        log <& "Finishing app..."
    
    main :: IO ()
    main = app logStringStdout