log4hs-0.6.0.0: A python logging style log library

Copyright(c) 2019 Version Cloud
LicenseBSD3
MaintainerJorah Gao <log4hs@version.cloud>
Stabilityexperimental
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Logging

Description

A python logging style log library.

A simple example:

  {-# LANGUAGE OverloadedStrings #-}
  {-# LANGUAGE TemplateHaskell   #-}

  module Main ( main ) where

  import           Logging.Config.Json (getManager)
  import           Logging.Global      (run)
  import           Logging.Global.TH   (debug, error, fatal, info, logv, warn)
  import           Prelude             hiding (error)

  main :: IO ()
  main = getManager "{}" >>= flip run app

  logger = "Main"

  app :: IO ()
  app = do
    $(debug) logger "this is a test message"
    $(info) logger "this is a test message"
    $(warn) logger "this is a test message"
    $(error) logger "this is a test message"
    $(fatal) logger "this is a test message"
    $(logv) logger "LEVEL 100" "this is a test message"

See Logging.Config.Json and Logging.Config.Yaml to lean more about decoding Manager from json or yaml

Documentation

module Logging.TH