log4hs-0.7.1.0: A python logging style log library

Safe HaskellNone
LanguageHaskell2010

Logging.Global

Description

Run logging globally.

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

If the Manager's catchUncaughtException is True, the run function will set an uncaught exception handler that will log all uncaught exceptions, and set the handler to the original one before run is complete.

Synopsis

Documentation

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

Run the global logging environment.

You should always 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
     ...