--
-----------------------------------------------------------------------------
-#ifndef __HUGS__
-#include "config.h"
-#endif
-
module Debug.Trace (
-- * Tracing
-- ** Tracers
-- | The tracer is a function that monitors the trace messages.
fileTracer, -- :: Handle -> String -> IO ()
-#ifdef mingw32_TARGET_OS
+#ifdef mingw32_HOST_OS
winDebugTracer, -- :: String -> IO ()
#endif
addTracer, -- :: String -> (String -> IO ()) -> IO ()
) where
import Prelude
+import Data.IORef
import System.IO.Unsafe
import System.IO
-#ifdef __GLASGOW_HASKELL__
-import GHC.IOBase
-import GHC.Handle
-#endif
-
+#ifdef mingw32_HOST_OS
import Foreign.C.String
+#endif
{-# NOINLINE tracers #-}
tracers :: IORef [(String, String -> IO ())]
hPutStr handle msg
hPutChar handle '\n'
-#ifdef mingw32_TARGET_OS
+#ifdef mingw32_HOST_OS
-- | A tracer function that outputs the message to the debuger (Windows only)
winDebugTracer :: String -- ^ trace message
-> IO ()