Mailfromd |
|
General-Purpose Mail Filter |
Sergey Poznyakoff |
Mailfromd Manual (split by node): | ? |
These functions allow to enable debugging and tracing for a certain piece of code.
Enable debugging. The value of spec sets the debugging level. See debugging level specification, for a description of its format.
This function returns the debugging level currently in effect for the source module srcname, or the global debugging level, if called without arguments.
For example, if the program was started with ‘--debug=20,engine=8’ option, then:
debug_level() ⇒ 20 debug_level("engine") ⇒ 8 debug_level("db") ⇒ 0 |
Returns the current debugging level specification, as given by
‘--debug’ command line option or by the debug
configuration
statement (see section Logging and Debugging configuration).
If the argument srcnames is specified, it is treated as a comma-separated list of source names for which the debugging specification is to be returned.
For example, if mailfromd
was started with
‘--debug=20,spf=50,engine=8,db=30’ option, then:
debug_spec("all,engine") ⇒ "20,engine=8" debug_spec("engine,db") ⇒ "db=30,engine=8" |
When called without arguments, debug_spec
returns full
debugging level specification, as shown in the example below:
debug_spec() ⇒ "20,debug=0,cache=0,dnscache=0,db=30,dns=0,dnsbase=0,engine=8, gram=0,lex=0,main=0,mf-status=0,mu_dbm=0,optab=0,prog=0, spf=50,stack=0,symtab=0,rate=0,bi_db=0,bi_dns=98,bi_io=0, bi_ipaddr=0,bi_mail=0,bi_poll=0,bi_sa=0,bi_spf=0,bi_string=7, bi_system=0,bi_other=0,bi_vars=0" |
These three functions are intended to complement each other. The
calls to debug
can be placed around some piece of code you wish
to debug, to enable specific debugging information for this code
fragment only. For example:
/* Save debugging level for ‘dns.c’ source */ set dlev debug_level("dns") /* Set new debugging level */ debug("dns=80") . . . /* Restore previous level */ debug("dns=%dlev") |
You can also change debugging levels for several modules simultaneously:
/* Save debugging specifications for the sources we are * interested in: */ set dspec debug_spec("dns,dnsbase,db") /* Set new debugging spec */ debug("dns=80,dnsbase=100,db=1") . . . /* Restore previous debug specification */ debug("%dspec") |
Enable tracing for a set of modules given in module argument. See –trace-program, for a description of its format.
Disable tracing for given modules.
This pair of functions is also designed to be used together in
a bracket-like fashion. They are useful for debugging
mailfromd
, but are not advised to use otherwise, since
tracing slows down the execution considerably.
Generate a stack trace in this point. See tracing runtime errors, for the detailed description of stack traces.
Mailfromd Manual (split by node): | ? |
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.