On Sep 21, 2005, at 2:00 PM, Rhesa Rozendaal wrote:

Michael Graham wrote:

Rhesa,
This is too cool!  I can think of all sorts of uses for this.  For
instance, it would be very useful to have a simple
logger/dumper/debugger plugin that lets you dump the app state at
various points in the app's life cycle.


I'm imagining a LogDispatch plugin that would collect those, and hand them over to DevPopup at the right time. This would be a great aid in development. I usually have a bunch of "tail -f"'s running, but this would be much easier to inspect!

Check out Log::Dispatch::Buffer. It's a nice way to collect log messages over the course of a request.

When I am done collecting messages, I use the following snippet of code to make them a bit nicer to read in my own development popup:

    my $log = $self->log->output("debug")->flush;
    foreach my $entry(@$log)
    {
        my ($color, %row);

        # Determine row color
        if   ($entry->{level} eq "debug")   { $color = "green";  }
        elsif($entry->{level} eq "info")    { $color = "blue";   }
        elsif($entry->{level} eq "warning") { $color = "orange"; }
        else                                { $color = "red";    }

        # Create the row
        $row{COLOR}   = $color;
        $row{LEVEL}   = $entry->{level};
        $row{MESSAGE} = $entry->{message};

        push @log, \%row;
    }

Hope this helps!
Jason


---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
             http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to