Permalink
Browse files

Finish normalizing log methods, and fix tests

  • Loading branch information...
1 parent 33d196f commit d58b21a2bd08b81d9812cf8381d26d4fe458951d Jeffrey Ryan Thalhammer committed Apr 6, 2012
Showing with 13 additions and 9 deletions.
  1. +1 −1 lib/Pinto/Batch.pm
  2. +1 −1 lib/Pinto/Database.pm
  3. +1 −1 lib/Pinto/Role/PackageImporter.pm
  4. +7 −4 t/07-logger.t
  5. +3 −2 t/09-create.t
View
@@ -176,7 +176,7 @@ sub _handle_action_error {
if ( blessed($error) && $error->isa('Pinto::Exception') ) {
$self->_result->add_exception($error);
- $self->whine($error);
+ $self->warning($error);
return $self;
}
View
@@ -87,7 +87,7 @@ sub insert_distribution {
$self->debug("Inserting distribution $dist into database");
- $self->whine("Developer distribution $dist will not be indexed")
+ $self->warning("Developer distribution $dist will not be indexed")
if $dist->is_devel() and not $self->config->devel();
my $txn_guard = $self->schema->txn_scope_guard(); # BEGIN transaction
@@ -61,7 +61,7 @@ sub find_or_import {
my $got_pkg = $self->repos->select_packages( $where )->single();
if ($got_pkg and $got_pkg->version() >= $pkg_ver) {
- $self->note("Already have package $pkg_vname or newer as $got_pkg");
+ $self->info("Already have package $pkg_vname or newer as $got_pkg");
return ($got_pkg->distribution(), 0);
}
View
@@ -19,15 +19,18 @@ use Pinto::Logger;
my $logger = Pinto::Logger->new(root => $root);
my $log_file = $root->subdir( qw(.pinto log) )->file('pinto.log');
- $logger->info('info'); # Should get logged
- $logger->debug('debug'); # Should not get logged
+ $logger->error('error'); # Logged
+ $logger->warning('warning'); # Logged
+ $logger->notice('notice'); # Logged
+ $logger->info('info'); # Not Logged
+ $logger->debug('info'); # Not Logged
ok -e $log_file, "log file exists at $log_file";
my @lines = $log_file->slurp();
- is scalar @lines, 1, 'log file contains one line';
+ is scalar @lines, 3, 'log file contains one line';
- like $lines[0], qr/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2} NOTICE: info$/,
+ like $lines[-1], qr/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2} NOTICE: notice$/,
'logged message is correct';
}
View
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More (tests => 11);
+use Test::More;
use Path::Class;
@@ -17,7 +17,6 @@ my $pinto = $t->pinto();
$t->path_exists_ok( [qw(.pinto config pinto.ini)] );
$t->path_exists_ok( [qw(.pinto db pinto.db)] );
-$t->path_exists_ok( [qw(.pinto log pinto.log)] );
$t->path_exists_ok( [qw(modules 02packages.details.txt.gz)] );
$t->path_exists_ok( [qw(modules 03modlist.data.gz)] );
$t->path_exists_ok( [qw(authors 01mailrc.txt.gz)] );
@@ -40,3 +39,5 @@ is $pinto->config->store(), 'MyStore', 'Got custom store';
is $pinto->config->sources(), 'MySource', 'Got custom source';
#------------------------------------------------------------------------------
+
+done_testing();

0 comments on commit d58b21a

Please sign in to comment.