co-log-core

Composable Contravariant Comonadic Logging Library

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

Version on this page:0.3.2.0@rev:1
LTS Haskell 22.43:0.3.2.2
Stackage Nightly 2024-12-07:0.3.2.2
Latest on Hackage:0.3.2.2

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.3.2.0@sha256:cef26597d94b12e6ffce8225dcccec12c8f2eb0dcea317f1ab02a754d54d5952,3970

Module documentation for 0.3.2.0

Depends on 1 package(full list with versions):
Used by 4 packages in lts-21.11(full list with versions):

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
    

Changes

Change log

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

0.3.2.0 — Nov 2, 2022

  • #25: Support GHC-9.4.

0.3.1.0 — Feb 15, 2022

  • #7: Support GHC-9.2.
  • #13: Add WithSeverity and mapSeverity to Colog.Severity.

🎃 0.3.0.0 — Oct 29, 2021

  • #223: Support GHC-9.0.1.

  • #176: Add logFlush action to flush the given Handle.

    Breaking change: All withLog*File functions how flush handle after logging each message. Now you’ll see logs in the file immediately.

    Migration guide: If you rely on the previous behaviour, then copy-paste corresponding functions and remove flushing.

  • Update maintainers information to the new Co-Log organization.

0.2.1.1 — Apr 18, 2020

  • #186: Support GHC-8.10.1.

0.2.1.0 — Jan 19, 2020

  • #139: Add (unrepresentable) Functor instance for LogAction with the custom type-error. (by @vrom911)
  • #148: Support GHC-8.8.2. (by @chshersh)
  • #122: Add the separate combinator. (by @vrom911)
  • #125: Add monadic versions of contravariant functions. (by @piq9117)
  • #138: Add hoistLogAction — higher-order transformation function. (by @jiribenes)
  • #123: Write default implementation to getLogAction via logActionL. (by @SanchayanMaity)

0.2.0.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.