Daryl C. W. O'Shea writes:
> John D. Hardin wrote:
> > On Tue, 22 Aug 2006, Matt Kettler wrote:
> >> John D. Hardin wrote:
> >>> Coders (if any):
> >>>
> >>> Can anybody point me at a code sample showing how to get details into
> >>> the report SUMMARY tag from within a plugin?
> >>>
> >>> Like the [IP address etc.] in this:
> >>>
> >>>     *  1.0 RBL_PSBL_01 RBL: Mail client listed by psbl.surriel.com
> >>>     *      [64.8.111.2 listed in psbl.surriel.com]
> >>>
> >>> I can't seem to figure it out.
> >> I took a casual glance at the code, it seems to be related to the
> >> "test_log" subroutine, which populates test_log_msgs, that later
> >> gets added to the REPORT and SUMMARY.
> > 
> > I got the same impression, but $self->test_log($msg); in the
> > plugin does not do it. Perhaps I'm doing it in the wrong place, I'll
> > keep at it.
> 
> I don't recall much about this, but I used this sub in my SIQ plugin (in 
> my sandbox) to take care of this:
> 
> sub _log_hit {
>    my ($self, $pms, $rulename, $text) = @_;
> 
>    $pms->test_log ($text);
>    $pms->got_hit ($rulename, "");
> }
> 
> 
> and then called _log_hit like this:
> 
> $self->_log_hit($pms, $rule_name, "SIQ: score: $results[4] 
> queried: ".                                 
> "$pms->{siq_domain}/$pms->{siq_ip}");
> 
> 
> So basically, call $pms->test_log() and then call $pms->got_hit().

Yep; got_hit() is the API that takes the logged text and adds it to
the report.  I think you can call test_log() multiple times.

We should probably document this ;)

--j.

Reply via email to