> 
> CHANGES in DBI 1.42 will say:
> 
>   Added $h->parse_trace_flags("foo|SQL|7") to map a group of
>     trace flags into the corresponding trace flag bits.
>   Added automatic calling of parse_trace_flags() if
>     setting the trace level to a non-numeric value:
>     $h->{TraceLevel}="foo|SQL|7"; $h->trace("foo|SQL|7");
>     DBI->connect("dbi:Driver(TraceLevel=SQL|foo):...", ...);
> 
> The DBI has 16 topic bits to play with. Drivers have 8. I expect
> the DBI to assign some of its bits to common 'driver topics' so the
> drivers own bits can be reserved for topics specific to each driver.
> 
> As you may expect, DBI topics names will begin with a capital letter
> and driver specific topics with a lowercase letter.
> 
> 
> For drivers written in C there'll be a macro like this:
> 
>   if (DBIc_TRACE_TLL( topic_flags, topic_flag_level, trace_level )) {
>       print(...);
>   }
> 
> Where topic_flags are one or more bit flags related to the message,
> topic_flag_level is the minimum trace_level at which the topic_flags
> should be tested (ie topic_flags must match _and_ the handle trace
> level must be at least topic_flag_level) and trace_level is the
> handle trace level at which to print regardless of topic_flags matching.
> DBIc_TRACE_TLL stands for trace topic-level-level.
> 
>   if (DBIc_TRACE_TLL( DBItf_FOO|DBItf_BAR, 2, 5 )) { print(...) }
> 
> will always print if the handle trace level is >= 9 otherwise it'll
> print if the FOO or BAR topic is set and the handle trace level is >= 2.
> 
> 
> What I'm after now is a bit of brainstorming on the topic of topics.
> 
> The 'SQL' topic I plan to use to generate a trace of SQL statements
> executed.  The output will be *just* the raw SQL statement, possibly
> with trailing whitespace replaced with a newline. If ParamValues
> is available then an SQL comment will be appended with the ParamValues.
> 
> A topic flag:
>  may enable new trace messages regardless of level
>  may enable new trace messages if level > some threshold
>  may add detail to existing trace messages
>  do anything else that seems like a good idea :)
> 
> Here are some ideas for other topics to get you started:
> 
>   HndCre   - handle creation detail (any type)
>   HndDest  - handle destruction detail (any type)
>   MethInst - method install detail
>   MethDisp - method dispatch detail
>   SetErrI  - set_err called to set info state
>   SetErrW  - set_err called to set warn state
>   SetErrE  - set_err called to set error state
>   SetErr   - set_err called to set any (SetI|SetW|SetE)
>   Prof     - Profiling detail
>   Pid      - Show process id in (some) trace messages
> 
> As you can see, I'd like to keep the names short but reasonably mnemonic.
> 
> A topic can turn on more than one flag, such as SetErr above, which
> will make it easy to split a topic into subtopics later if we want to
> There'll also be an 'ALL' to turn on all flag bits, handy for testing
> all the tracing code, or for masochists :)
> 
> 
> Part of the reason for doing all this is so that high trace levels
> can provide greater detail on a topic without being drowned in other
> trace output. The first four topics above are all targeted a removing
> 'obscure details' from the 'normal' trace. I think that's one of the
> best uses for topics: Let the normal trace levels be less cluttered.
> 
> Tim.
> 
> p.s. A reminder: a driver should output no trace information at all
> at trace levels 1 and 2 (unless a specific topic is enabled).

How about a 'Protocol' topic that permits dumping client<->server
protocol traces (ie bits on the wire) ? 
(useful for pure perl drivers,
tho maybe not possible for drivers requiring external libraries,
eg ODBC)

Dean Arnold
Presicient Corp.
www.presicient.com

Reply via email to