heavy-logger-0.3.2.1: Full-weight logging based on fast-logger

Safe HaskellNone
LanguageHaskell2010

System.Log.Heavy.IO

Contents

Description

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

Documentation

withLoggingIO Source #

Arguments

:: 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