Hi,<br><br>I have a Catalyst app, running 5.7011, and I keep the debugging log turned on as the parameters and sequence of events is far more useful than the disk space and request overhead, at least currently.<br><br>Recently, I've had to start accepting credit cards. I'm required to not log them, but I'd also like to keep the debug log going. So, I've copied Catalyst.pm's prepare_body() method into MyApp.pm, and added the following line to the block which prepares the Text::SimpleTable output for the log:<br>
<br> my $t = Text::SimpleTable->new( [ 35, 'Parameter' ], [ 36, 'Value' ] );<br> for my $key ( sort keys %{ $c->req->body_parameters } ) {<br> my $param = $c->req->body_parameters->{$key};<br>
my $value = defined($param) ? $param : '';<br>+ $value = (grep { $key eq $_ } qw(cardnumber password)) ? '<masked>' : $value;<br> $t->row( $key,<br> ref $value eq 'ARRAY' ? ( join ', ', @$value ) : $value );<br>
}<br><br>As you can see, I've taken the opportunity to mask the password from the log too.<br><br>My question is: is there a better, or more Catalyst-approved way of accomplishing this? This seemed to be the most direct/simple way, but it would have been nice if the Text::SimpleTable stuff was in a method of its own.<br>
<br>Thanks,<br><br>-- <br>Ewan Edwards, <a href="mailto:eskwayrd@gmail.com">eskwayrd@gmail.com</a><br>