snap-core-1.0.5.1: Snap: A Haskell Web Framework (core interfaces and types)

Safe Haskell | Safe-Inferred
Language | Haskell2010

Snap.Internal.Debug

Description

An internal Snap module for (optionally) printing debugging messages. To enable debug output, compile the library with the `debug` flag (off by default) and set the environment variable `DEBUG` to `1`. We use `unsafePerformIO` to make sure that the call to `getEnv` is only made once.

N.B. this is an internal interface, please don't write external code that depends on it.

Synopsis

- debug :: MonadIO m => String -> m ()
- debugErrno :: MonadIO m => String -> m ()

# Documentation

debug :: MonadIO m => String -> m () Source #

Print out the provided debug message prefixed by the thread ID.

Example:

    ghci> debug "Some debug message"
    [     225] Some debug message

debugErrno :: MonadIO m => String -> m () Source #

Print out the error message corresponding to the `Errno` value returned by `getErrno` together with any additional information provided by the user (usually the location where the error occurred).

Example:

    ghci> debugErrno "pathtoSource.hs:34"
    [     323] pathtoSource.hs:34: failed (Success)