log4hs-0.9.0.0: A python logging style log library

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

Logging.Global

Description

Run logging globally.

The run function will properly "initialize" and "terminate" the global Manager.

Synopsis

Documentation

run :: Manager -> IO a -> IO a Source #

Run the global logging environment.

Run you application in the global logging environment.

   main :: IO ()
   main = run manager app

   app :: IO ()
   app = do
     $(info) "App" "..."
     ...
 

Never run multiple global logging environments concurrently.

   -- bad useage
   main :: IO ()
   main = do
     forkIO $ run manager1 app1
     forkIO $ run manager2 app2
     ...

   -- correct useage
   main :: IO ()
   main = run manager $ do
     forkIO app1
     forkIO app2
     ...
 

Note: If there is an unhandled Exception in your application, it will be logged into the root Sink, and then rethrown.