co-log-core: Composable Contravariant Comonadic Logging Library

[ comonad, contravariant, library, logging, mpl ] [ Propose Tags ] [ Report a vulnerability ]

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

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, 0.3.2.2, 0.3.2.3
Change log CHANGELOG.md
Dependencies base (>=4.10.1.0 && <4.21) [details]
Tested with ghc ==8.2.2, ghc ==8.4.4, ghc ==8.6.5, ghc ==8.8.4, ghc ==8.10.7, ghc ==9.0.2, ghc ==9.2.8, ghc ==9.4.8, ghc ==9.6.6, ghc ==9.8.4, ghc ==9.10.1
License MPL-2.0
Copyright 2018-2020 Kowainik, 2021-2025 Co-Log
Author Dmitrii Kovanikov
Maintainer Co-Log <xrom.xkov@gmail.com>
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 alaendle at 2024-12-15T08:31:49Z
Distributions Arch:0.3.2.2, LTSHaskell:0.3.2.3, NixOS:0.3.2.2, Stackage:0.3.2.3
Reverse Dependencies 25 direct, 58 indirect [details]
Downloads 9773 total (296 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 2024-12-15 [all 1 reports]

Readme for co-log-core-0.3.2.3

[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