úÎ!4º2,      !"#$%&'()*+None0 +di Obtain a , that will write logs in the df1 format to .!Generally, you will want to call +- just once per application, right from your main function. For example: main :: -' () main = do -- First you obtain a ,-. -- You do this once per application, in main. +X $ \di -> do -- You can start logging right away by acting -- on the on the ,. object, but here -- we encourage using '8 and perforfing -- all your logging from within a #. '7 di $ do -- Our first log message! 3 "Welcome to my program!" -- You can use pushN to separate different -- logging scopes of your program: !% "initialization" $ do % "Starting web server" D "Disk is almost full!!!" -- Yet another scope. !, "server" $ do -- You can use  ^ to add metadata to -- messages logged within a particular scope.  , "port" (80 :: Int) $ do Å "Listening for new clients" clientAddress <- do -- This is just an example. Whatever. pure ("10.0.0.8" :: String) !& "handler" $ do  > "client-address" clientAddress $ do ÿÿ "Connection established" -- If you throw an exception with throw, -- it will be logged automatically together -- with its current scope. Isn't that nice? % (userError "Oops!") 0That program will render something like this to : @https://raw.githubusercontent.com/k0001/di/df1-0.3.2/df1/df1.png df1 examplesYou get the nice colors only if the output is going to a TTY. Otherwise, you get the same, but without any colors. ÿø2019-11-15T18:05:54.949470902Z NOTICE Welcome to my program! 2019-11-15T18:05:54.949623731Z /initialization NOTICE Starting web server 2019-11-15T18:05:54.949630205Z /initialization ALERT Disk is almost full!!! 2019-11-15T18:05:54.949640299Z /server port=80 INFO Listening for new clients 2019-11-15T18:05:54.949652133Z /server port=80 /handler client-address=10.0.0.8 INFO Connection established 2019-11-15T18:05:54.949664482Z /server port=80 /handler client-address=10.0.0.8 WARNING user error (Oops!) Notice that by default, all exceptions thrown using % are logged at their throw site with ./ level. You can change that if you care using /. Unrelated: df19 escapes conflicting punctuation characters as necessary.+diThis type is the same as $ -> m a.,Within this scope, you can use the obtained ,( safely, even concurrently. As soon as m a finishes, +G will block until all logs have finished processing, before returning.WARNING: Even while + commit 0 :: m (,    )- type-checks, attempting to use the obtained ,' outside its intended scope will fail.di,  *)( !"#$%&'+,+! %'&*)($"#   1      !"#$%&'()*+,-./0123456789:;<=>?@Adi-1.3-Bpn6zkKTAPF6APxoKbQzZYDi System.IOstderr df1-0.3.2-KDPqdx7lxyTLa9a0QWxvMl Df1.TypesMessagemessage ToMessageLevelSegmentsegment ToSegmentKeykeyToKeyValuevalueToValuePath%di-monad-1.3.1-HmIPZyKPRYXI7III9AbYo2Di.MonadMonadDi!di-df1-1.2-L82UmOFOjzpJorZqie6fH0 Di.Df1.Monaddebug_info_notice_warning_error_alert_ critical_ emergency_debuginfonoticewarningerrorcriticalalert emergencyattr_attrpushDf1TMonadDf1Di.Df1Df1throwhoistDiTrunDiTnatSTMlocalasknew$di-core-1.0.4-GcSN3LXRDBd7KPkoGfm3SsDi.Coreghc-prim GHC.TypesIOWarning onExceptionbaseGHC.Basepure