I would like to propose adding several features to tools.trace:
The ability to trottle tracing using several characteristics:
Number of messages logged.
Number of times called.
Size of output generated
Times logged in a given period
The ability to trace only certain calls:
Trace calls to functions with specific values for their argument