How to best add logging/debugging code?

Andy Fugard andyfugard at eircom.net
Wed Nov 26 18:31:44 EST 2003


Manuel M T Chakravarty wrote:

> There is `Debug.Trace.trace' for this:
> 
>   http://haskell.org/ghc/docs/latest/html/base/Debug.Trace.html
> 
> However, if you want to log as opposed to debug, you may
> want to have the output go to somewhere else but stdout.
> Hence, it might be useful to have a variant of the `trace'
> that takes an explicit file handle in the library.

Is there a list of problems anywhere with using trace?  For example does 
it affect evaluation order?  (I'm not sure of the semantics of 
unsafePerformIO!)

The output from "trace" goes to stderr by the way.

Cheers,

Andy




More information about the Haskell mailing list