logo       
Google Custom Search
    AddThis Social Bookmark Button

Re: basic question about logging from TT: msg#00063

Subject: Re: basic question about logging from TT
markd wrote:
I know I can do:

 [% PERL %]
   print STDERR "message";
 [% END %]

But tedious (and presumably inefficient?)

I usually do something like this in a PRE_PROCESS config file:

   [% IF debug;
        MACRO debug_msg(text)
          FILTER stderr; "  # $text\n"; END;
      ELSE;
        debug_msg = '';
      END;
   %]

I use a 'debug' flag (set in my ttree config file or in variables passed in from my Perl code/Apache handle) to enable/disable debugging en masse. If debugging is on then the debug_msg() MACRO is defined to print its argument to stderr (via the stderr FILTER), otherwise it's a nullup.

Then in my templates I write:

   [% debug_msg("Hello World") %]

HTH
A



Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>