r26413 - in /branches/upstream/liblog-handler-perl/current: Build.PL ChangeLog INSTALL META.yml lib/Log/Handler.pm lib/Log/Handler/Output/Email.pm t/017-handler-special-levels.t t/040-output-email.t
rmayorga-guest at users.alioth.debian.org
rmayorga-guest at users.alioth.debian.org
Sat Nov 1 01:21:09 UTC 2008
Author: rmayorga-guest
Date: Sat Nov 1 01:21:04 2008
New Revision: 26413
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=26413
Log:
[svn-upgrade] Integrating new upstream version, liblog-handler-perl (0.48)
Modified:
branches/upstream/liblog-handler-perl/current/Build.PL
branches/upstream/liblog-handler-perl/current/ChangeLog
branches/upstream/liblog-handler-perl/current/INSTALL
branches/upstream/liblog-handler-perl/current/META.yml
branches/upstream/liblog-handler-perl/current/lib/Log/Handler.pm
branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Output/Email.pm
branches/upstream/liblog-handler-perl/current/t/017-handler-special-levels.t
branches/upstream/liblog-handler-perl/current/t/040-output-email.t
Modified: branches/upstream/liblog-handler-perl/current/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-handler-perl/current/Build.PL?rev=26413&op=diff
==============================================================================
--- branches/upstream/liblog-handler-perl/current/Build.PL (original)
+++ branches/upstream/liblog-handler-perl/current/Build.PL Sat Nov 1 01:21:04 2008
@@ -15,6 +15,7 @@
'DBI' => 0,
'IO::Socket' => 0,
'Net::SMTP' => 0,
+ 'Email::Date' => 0,
'YAML' => 0,
},
requires => {
Modified: branches/upstream/liblog-handler-perl/current/ChangeLog
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-handler-perl/current/ChangeLog?rev=26413&op=diff
==============================================================================
--- branches/upstream/liblog-handler-perl/current/ChangeLog (original)
+++ branches/upstream/liblog-handler-perl/current/ChangeLog Sat Nov 1 01:21:04 2008
@@ -1,3 +1,11 @@
+0.48 Released at 2008-10-28.
+ - Fixed a bug in Email.pm - no error message if a email
+ couldn't be send.
+ - Added Email::Date to send the date with a email.
+ - EMAIL: if the key $message->{level} exists then the level is
+ used in the subject: "$level: $subject". The level can
+ passed with the option message_pattern.
+
0.47 Released at 2008-09-04.
- Add new config features. Now it's possilbe to add the
configuration for the outputs as a array reference.
Modified: branches/upstream/liblog-handler-perl/current/INSTALL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-handler-perl/current/INSTALL?rev=26413&op=diff
==============================================================================
--- branches/upstream/liblog-handler-perl/current/INSTALL (original)
+++ branches/upstream/liblog-handler-perl/current/INSTALL Sat Nov 1 01:21:04 2008
@@ -4,7 +4,7 @@
make
make test
-"make test" do some tests. If you get failed messages then you shouldn't install the module.
+"make test" do some tests. If you get error messages then you shouldn't install the module.
Otherwise your last step is:
make install
Modified: branches/upstream/liblog-handler-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-handler-perl/current/META.yml?rev=26413&op=diff
==============================================================================
--- branches/upstream/liblog-handler-perl/current/META.yml (original)
+++ branches/upstream/liblog-handler-perl/current/META.yml Sat Nov 1 01:21:04 2008
@@ -1,6 +1,6 @@
---
name: Log-Handler
-version: 0.47
+version: 0.48
author:
- Jonny Schulz
abstract: Log messages to several outputs.
@@ -24,13 +24,14 @@
Config::General: 0
Config::Properties: 0
DBI: 0
+ Email::Date: 0
IO::Socket: 0
Net::SMTP: 0
YAML: 0
provides:
Log::Handler:
file: lib/Log/Handler.pm
- version: 0.47
+ version: 0.48
Log::Handler::Config:
file: lib/Log/Handler/Config.pm
version: 0.04
@@ -45,7 +46,7 @@
version: 0.03
Log::Handler::Output::Email:
file: lib/Log/Handler/Output/Email.pm
- version: 0.02
+ version: 0.03
Log::Handler::Output::File:
file: lib/Log/Handler/Output/File.pm
version: 0.02
Modified: branches/upstream/liblog-handler-perl/current/lib/Log/Handler.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-handler-perl/current/lib/Log/Handler.pm?rev=26413&op=diff
==============================================================================
--- branches/upstream/liblog-handler-perl/current/lib/Log/Handler.pm (original)
+++ branches/upstream/liblog-handler-perl/current/lib/Log/Handler.pm Sat Nov 1 01:21:04 2008
@@ -849,7 +849,7 @@
use Log::Handler::Pattern;
use base qw(Log::Handler::Levels);
-our $VERSION = '0.47';
+our $VERSION = '0.48';
our $ERRSTR = '';
# $TRACE and $CALLER_LEVEL are both used as global
Modified: branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Output/Email.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Output/Email.pm?rev=26413&op=diff
==============================================================================
--- branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Output/Email.pm (original)
+++ branches/upstream/liblog-handler-perl/current/lib/Log/Handler/Output/Email.pm Sat Nov 1 01:21:04 2008
@@ -22,7 +22,7 @@
=head1 DESCRIPTION
With this output module it's possible to log messages via email and it used
-Net::SMTP to do it.
+Net::SMTP to do it. The date for the email is generated with C<Email::Date::format_date>.
Net::SMTP is from Graham Barr and it does it's job very well.
@@ -129,6 +129,7 @@
=head1 PREREQUISITES
Carp
+ Email::Date
Net::SMTP
Params::Validate
@@ -162,8 +163,9 @@
use Net::SMTP;
use Params::Validate;
use Carp;
-
-our $VERSION = '0.02';
+use Email::Date;
+
+our $VERSION = '0.03';
our $ERRSTR = '';
our $TEST = 0; # is needed to disable flush() for tests
@@ -178,11 +180,11 @@
my $message = @_ > 1 ? {@_} : shift;
if ($self->{buffer} == 0) {
- $self->sendmail($message);
+ return $self->sendmail($message);
}
if (@{$self->{MESSAGE_BUFFER}} < $self->{buffer}) {
- push @{$self->{MESSAGE_BUFFER}}, $message->{message};
+ push @{$self->{MESSAGE_BUFFER}}, $message;
}
if (@{$self->{MESSAGE_BUFFER}} == $self->{buffer}) {
@@ -193,23 +195,35 @@
}
sub flush {
- my $self = shift;
+ my $self = shift;
my $message = ();
-
- return 1 if $TEST || !@{$self->{MESSAGE_BUFFER}};
-
- while (my $line = shift @{$self->{MESSAGE_BUFFER}}) {
- $message .= $line;
- }
-
- return $self->sendmail(message => $message);
+ my $string = '';
+
+ if ($TEST || !@{$self->{MESSAGE_BUFFER}}) {
+ return 1;
+ }
+
+ # Safe the last message to use the level for the subject
+ $message = pop @{$self->{MESSAGE_BUFFER}};
+
+ while (my $buffer = shift @{$self->{MESSAGE_BUFFER}}) {
+ $string .= $buffer->{message};
+ }
+
+ $message->{message} = $string . $message->{message};
+ return $self->sendmail($message);
}
sub sendmail {
my $self = shift;
my $message = @_ > 1 ? {@_} : shift;
my $subject = $message->{subject} || $self->{subject};
+ my $date = Email::Date::format_date();
my $smtp = ();
+
+ if ($message->{level}) {
+ $subject = "$message->{level}: $subject";
+ }
foreach my $host (@{$self->{host}}) {
$smtp = Net::SMTP->new(
@@ -222,7 +236,7 @@
}
if (!$smtp) {
- return $self->_raise_error("smtp error: unable to connect to any host");
+ return $self->_raise_error("smtp error: unable to connect to ".join(', ', @{$self->{host}}));
}
my $success = 0;
@@ -232,11 +246,12 @@
$success++ if $smtp->datasend("From: $self->{from}\n");
$success++ if $smtp->datasend("To: $self->{to}\n");
$success++ if $smtp->datasend("Subject: $subject\n");
+ $success++ if $smtp->datasend("Date: $date\n");
$success++ if $smtp->datasend($message->{message}."\n");
$success++ if $smtp->dataend();
$success++ if $smtp->quit();
- if ($success != 9) {
+ if ($success != 10) {
return $self->_raise_error("smtp error($success): unable to send mail to $self->{to}");
}
Modified: branches/upstream/liblog-handler-perl/current/t/017-handler-special-levels.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-handler-perl/current/t/017-handler-special-levels.t?rev=26413&op=diff
==============================================================================
--- branches/upstream/liblog-handler-perl/current/t/017-handler-special-levels.t (original)
+++ branches/upstream/liblog-handler-perl/current/t/017-handler-special-levels.t Sat Nov 1 01:21:04 2008
@@ -16,6 +16,7 @@
EMERGENCY => 2,
FATAL => 1,
);
+
my @LEVELS = (qw/
debug
info
Modified: branches/upstream/liblog-handler-perl/current/t/040-output-email.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblog-handler-perl/current/t/040-output-email.t?rev=26413&op=diff
==============================================================================
--- branches/upstream/liblog-handler-perl/current/t/040-output-email.t (original)
+++ branches/upstream/liblog-handler-perl/current/t/040-output-email.t Sat Nov 1 01:21:04 2008
@@ -6,6 +6,11 @@
eval "use Net::SMTP;";
if ($@) {
plan skip_all => "No Net::SMTP installed";
+ exit(0);
+ }
+ eval "use Email::Date;";
+ if ($@) {
+ plan skip_all => "No Email::Date installed";
exit(0);
}
};
@@ -19,7 +24,7 @@
host => [ 'bloonix.de' ],
hello => 'EHLO bloonix.de',
timeout => 60,
- debug => 1,
+ debug => 0,
from => 'jschulz.cpan at bloonix.de',
to => 'jschulz.cpan at bloonix.de',
subject => 'Log::Handler::Output::Email test',
@@ -40,7 +45,7 @@
foreach my $line ( @{$log->{MESSAGE_BUFFER}} ) {
++$all_lines;
- next unless $line =~ /^test \d+$/;
+ next unless $line->{message} =~ /^test \d+$/;
++$match_lines;
}
More information about the Pkg-perl-cvs-commits
mailing list