FAQ
Awhile ago Jochen Voss posted http://www.seehuhn.de/pages/trace/. I liked
the basic idea of the listener, and also added logic that I thought would
defer expensive parameter evaluation: https://github.com/jimrobinson/trace/.

The idea is that you can write something the following:

traceFn, traceT := trace.M("github.com/jimrobinson/httpclient", trace.Trace);

...

if traceT {
     trace.T(traceFn, "http request: %v", req)
}

So you have a fairly light-weight call to pick up traceFn and traceT, which
capture active listeners for trace level debugging and a flag indicating
that
listeners are in fact available, and then you guard your trace evaluation
with
the traceT boolean.
On Sunday, August 7, 2011 11:47:16 PM UTC-7, kortschak wrote:

Hi,

I'm wondering what people do in place of the C/C++ idiom of

#define DEBUG

#ifdef DEBUG
printf("foo %d", bar);
#endif

Particularly where there may be many wrapped debug printing
statements.


thanks
Dan
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedApr 18, '14 at 2:17a
activeApr 18, '14 at 2:17a
posts1
users1
websitegolang.org

1 user in discussion

Jim Robinson: 1 post

People

Translate

site design / logo © 2022 Grokbase