[Jifty-commit] jifty branch, setupwizard-refactor, updated. 58fc18bb5d71604bace0002b48b72de285a5f3b6

Jifty commits jifty-commit at lists.jifty.org
Wed Jun 23 16:11:38 EDT 2010


The branch, setupwizard-refactor has been updated
       via  58fc18bb5d71604bace0002b48b72de285a5f3b6 (commit)
       via  32b798459b2a1eca36ab246448a1104b033d8d8e (commit)
      from  b77c459d59ac632d1c598884f733a3729fbfc945 (commit)

Summary of changes:
 lib/Jifty/Plugin/TestServerWarnings.pm          |   27 +++++++++++++++-------
 lib/Jifty/Plugin/TestServerWarnings/Appender.pm |    3 +-
 2 files changed, 20 insertions(+), 10 deletions(-)

- Log -----------------------------------------------------------------
commit 32b798459b2a1eca36ab246448a1104b033d8d8e
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed Jun 23 16:09:17 2010 -0400

    Make the clear_screen option actually work

diff --git a/lib/Jifty/Plugin/TestServerWarnings.pm b/lib/Jifty/Plugin/TestServerWarnings.pm
index d170350..35d590e 100644
--- a/lib/Jifty/Plugin/TestServerWarnings.pm
+++ b/lib/Jifty/Plugin/TestServerWarnings.pm
@@ -26,28 +26,31 @@ Jifty::Plugin::TestServerWarnings - Stores server warnings away for later fetchi
 
 This plugin add a new appender L<Jifty::Plugin::TestServerWarnings::Appender>
 on the first request it sees, which stores away all messages it receives. 
-It also removes the default "Screen" appender unless clear_screen in
-config.yml is set to be false or env TEST_VERBOSE is true.
+
+It also removes the default "Screen" appender unless C<clear_screen> in the
+plugin config is false or the environment variable C<TEST_VERBOSE> is true.
 
 The warnings can be retrieved by a client-side process by calling 
 L</decoded_warnings> with a base URI to the server.
 
-This plugin is automatically added for all jifty tests.
+This plugin is automatically added for all Jifty tests.
 
 =head1 METHODS
 
 =head2 init
 
-set clear_screen to 1 if the clear_screen in config.yml is set to be true,
-if it's not set at all, set it to 1 if TEST_VERBOSE is set to be true.
+Store the C<clear_screen> setting if it's set in the plugin config.  If it's
+not set in the config, default to true unless the environment variable
+C<TEST_VERBOSE> is true.
 
 =cut
 
 sub init {
     my $self = shift;
     my %opt = @_;
+
     if ( defined $opt{clear_screen} ) {
-        $self->clear_screen( 1 ) if $opt{clear_screen};
+        $self->clear_screen( $opt{clear_screen} );
     }
     elsif ( ! $ENV{TEST_VERBOSE} ) {
         $self->clear_screen( 1 );

commit 58fc18bb5d71604bace0002b48b72de285a5f3b6
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed Jun 23 16:10:32 2010 -0400

    Set the appender threshold rather than the root logger level
    
    This preserves the output of other appenders that may be configured and
    lets Jifty's LogLevel and LogConfig options keep working.

diff --git a/lib/Jifty/Plugin/TestServerWarnings.pm b/lib/Jifty/Plugin/TestServerWarnings.pm
index 35d590e..528e440 100644
--- a/lib/Jifty/Plugin/TestServerWarnings.pm
+++ b/lib/Jifty/Plugin/TestServerWarnings.pm
@@ -6,7 +6,7 @@ use base qw/Jifty::Plugin/;
 
 use LWP::Simple qw//;
 use Jifty::Plugin::TestServerWarnings::Appender;
-use Log::Log4perl::Level;
+use Log::Log4perl::Appender;
 
 __PACKAGE__->mk_accessors(qw(clear_screen));
 
@@ -72,9 +72,15 @@ sub new_request {
 
     Log::Log4perl->eradicate_appender("Screen") if $self->clear_screen;
 
-    my $a = Jifty::Plugin::TestServerWarnings::Appender->new(name => "TestServerAppender");
+    my $a = Log::Log4perl::Appender->new(
+        "Jifty::Plugin::TestServerWarnings::Appender",
+        name => "TestServerAppender"
+    );
+
+    # Only log warnings so that we only spit back warnings later
+    $a->threshold('WARN');
+
     Log::Log4perl->get_logger("")->add_appender($a);
-    Log::Log4perl->get_logger("")->level($WARN);
 }
 
 =head2 add_warnings WARN, WARN, ..
diff --git a/lib/Jifty/Plugin/TestServerWarnings/Appender.pm b/lib/Jifty/Plugin/TestServerWarnings/Appender.pm
index b15923f..79d61b6 100644
--- a/lib/Jifty/Plugin/TestServerWarnings/Appender.pm
+++ b/lib/Jifty/Plugin/TestServerWarnings/Appender.pm
@@ -34,8 +34,9 @@ storage.
 
 sub log {
     my $self = shift;
+    my %params = @_;
     my $plugin = Jifty->find_plugin("Jifty::Plugin::TestServerWarnings");
-    my $message = $_[0]{message};
+    my $message = $params{message};
     $message = join('',@{$message}) if ref $message eq "ARRAY";
     $plugin->add_warnings($message);
 }

-----------------------------------------------------------------------


More information about the Jifty-commit mailing list