Welcome to tracing’s documentation!¶
This module provides fast debugging log messages that can be turned on and off during runtime.
It is sometimes practical to add a lot of debugging log messages to a program, but having them enabled all the time results in very large log files. Also, logging that much takes quite a bit of time. Yet, keeping the logging statements can be a good idea so that they can be enabled if there is a problem that needs debugging, as long as there is a way to disable them in normal production mode.
This module provides a way to achieve that. For example:
# in the main program import tracing tracing.trace_add_pattern('foobar') tracing.trace_add_pattern('yeehaa') ... # in some other module tracing.trace('start procedure') tracing.trace('arg1=%s', arg1) tracing.trace('arg2=%s', arg2)
Only calls that happen in files whose names contain
yeehaa will actually be logged. Pattern matching is based on
substring checking only, for speed, so there is no globbing or
regular expression matching.
Log a trace message if the calling module’s name matches a pattern.
If any arguments are given, the message is formatted as if with
msg % args, otherwise the message is written out as is.
Add a module name pattern.
Remove all module name patterns.
After this, nothing will be traced. This is also the initial state.