Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains implementation of HasLogger
, HasLogBackend
, HasLogContext
instances for IO monad.
This implementation uses thread-local storage, so each thread will have it's own logging state (context and logger).
This module is not automatically re-exported by System.Log.Heavy, because in many cases it is more convinient to maintain logging state within monadic context, than in global variable.
Note: implementations of HasLogger
, HasLogBackend
, HasLogContext
for IO, provided by this module, work only inside
withLoggingIO
call. If you try to call logging functions outside, you will get runtime error.
Synopsis
- withLoggingIO :: LoggingSettings -> IO a -> IO a
Documentation
:: LoggingSettings | Settings of arbitrary logging backend |
-> IO a | Actions to be executed with logging |
-> IO a |
Execute IO actions with logging.
Note 1: logging methods calls in IO monad are only valid inside withLoggingIO
.
If you try to call them outside of this function, you will receive runtime error.
Note 2: if you will for some reason call withLoggingIO
inside withLoggingIO
within one
thread, you will receive runtime error.
Note 3: You can call withLoggingIO
syntactically inside withLoggingIO
, but within other
thread. I.e., the construct like following is valid:
withLoggingIO settings $ do $info "message" () ... forkIO $ do withLoggingIO settings $ do $info "message" () ...
Orphan instances
HasLogContext IO Source # | |
withLogContext :: LogContextFrame -> IO a -> IO a Source # | |
HasLogger IO Source # | |
getLogger :: IO SpecializedLogger Source # localLogger :: SpecializedLogger -> IO a -> IO a Source # | |
HasLogBackend AnyLogBackend IO Source # | |