Revision history for Sys-Syslog
+0.16 -- 2006.06.20 -- Sebastien Aperghis-Tramoni (SAPER)
+ [BUGFIX] Perl-RT#20557: Save errno before trying to connect.
+ [FEATURE] Perl-RT#35406: Applied the patch proposed by Keisuke Hirata
+ for a more lax handling of "stream" or "unix" path.
+ [FEATURE] Now try the "native" mechanism first.
+ [TESTS] Silence warnings generated by t/syslog.t in Perl 5.8.8 and
+ later.
+ [DOC] Added documentation about the "native" mechanism.
+ [DOC] Now indicates whether tickets are from CPAN or Perl RT.
+
+
0.15 -- 2006.06.10 -- Sebastien Aperghis-Tramoni (SAPER)
- [FEATURE] RT#17316: Added a "nofatal" option to openlog().
+ [FEATURE] CPAN-RT#17316: Added a "nofatal" option to openlog().
[FEATURE] Sys::Syslog warnings can now be controled by the warnings
category of the same name.
[FEATURE] Added support for using the native C syslog(3) functions.
parentheses.
0.14 -- 2006.05.25 -- Sebastien Aperghis-Tramoni (SAPER)
- [BUGFIX] RT#19259, RT#17518: Now allowing all levels and facilities.
+ [BUGFIX] CPAN-RT#19259, #17518: Now allowing all levels and facilities.
[CODE] Removed useless "&".
[CODE] Improved readability by adding empty lines and reworking the
code here and there.
[CODE] Added new macros from Mac OS X.
[TESTS] Added more tests in order to increase coverage.
- [DOC] RT#19085: Corrected errors in the documentation for setlogmask().
+ [DOC] CPAN-RT#19085: Corrected errors in the documentation for setlogmask().
[DOC] Added several links to online manual pages, RFCs and articles.
[DOC] Corrected minor things in Changes.
use INADDR_LOOPBACK.
[CODE] Merged blead@26772: $host needs to stay in case the user sets it.
[CODE] Merged blead@26773: check that $syslog_path is a socket.
- [TESTS] RT#16980 (Alan Burlison): Sys::Syslog blows up rather
+ [TESTS] CPAN-RT#16980 (Alan Burlison): Sys::Syslog blows up rather
spectacularly on Solaris. Corrected by previous patches.
- [TESTS] RT#16974: Failed test in t/podspell. This test is now skipped.
+ [TESTS] CPAN-RT#16974: Failed test in t/podspell. This test is now skipped.
0.12 -- 2006.01.07 -- Sebastien Aperghis-Tramoni (SAPER)
[DOC] Added a link to an article about Sys::Syslog.
[FEATURE] Support for three Exporter tags.
[FEATURE] XSLoader is now optional.
[CODE] No longer "use"s Sys::Hostname as it was "require"d where needed.
- [CODE] RT#16604: Use local timestamp.
+ [CODE] CPAN-RT#16604: Use local timestamp.
[DIST] Merged blead@26343: Fix realclean target.
[DOC] Improved documentation.
[TESTS] Added more tests to t/syslog.t in order to increase code coverage.
require Exporter;
{ no strict 'vars';
- $VERSION = '0.15';
+ $VERSION = '0.16';
@ISA = qw(Exporter);
%EXPORT_TAGS = (
# it would be nice to try stream/unix first, since that will be
# most efficient. However streams are dodgy - see _syslog_send_stream
-my @connectMethods = ( 'tcp', 'udp', 'unix', 'stream', 'console' );
+my @connectMethods = qw(native tcp udp unix stream console);
if ($^O =~ /^(freebsd|linux)$/) {
@connectMethods = grep { $_ ne 'udp' } @connectMethods;
}
}
} elsif (lc $setsock eq 'unix') {
- if (length _PATH_LOG() && !defined $syslog_path) {
- $syslog_path = _PATH_LOG();
+ if (length _PATH_LOG() || (defined $syslog_path && -w $syslog_path)) {
+ $syslog_path = _PATH_LOG() unless defined $syslog_path;
@connectMethods = ( 'unix' );
} else {
warnings::warnif 'unix passed to setlogsock, but path not available';
my (@words, $num, $numpri, $numfac, $sum);
my $failed = undef;
my $fail_time = undef;
+ my $error = $!;
my $facility = $facility; # may need to change temporarily.
croak "syslog: expecting argument \$priority" unless defined $priority;
croak "syslog: expecting argument \$format" unless defined $mask;
- @words = split(/\W+/, $priority, 2);# Allow "level" or "level|facility".
+ @words = split(/\W+/, $priority, 2); # Allow "level" or "level|facility".
undef $numpri;
undef $numfac;
foreach (@words) {
- $num = xlate($_); # Translate word to number.
+ $num = xlate($_); # Translate word to number.
if ($num < 0) {
croak "syslog: invalid level/facility: $_"
}
connect_log() unless $connected;
if ($mask =~ /%m/) {
- my $err = $!;
# escape percent signs if sprintf will be called
- $err =~ s/%/%%/g if @_;
+ $error =~ s/%/%%/g if @_;
# replace %m with $err, if preceded by an even number of percent signs
- $mask =~ s/(?<!%)((?:%%)*)%m/$1$err/g;
+ $mask =~ s/(?<!%)((?:%%)*)%m/$1$error/g;
}
$mask .= "\n" unless $mask =~ /\n$/;
my ($errs) = @_;
# might want syslog_path to be variable based on syslog.h (if only
# it were in there!)
- $syslog_path = '/dev/conslog';
+ $syslog_path = '/dev/conslog' unless defined $syslog_path;
if (!-w $syslog_path) {
push @$errs, "stream $syslog_path is not writable";
return 0;
sub connect_unix {
my ($errs) = @_;
- if (length _PATH_LOG()) {
+ if (not defined $syslog_path and length _PATH_LOG()) {
$syslog_path = _PATH_LOG();
} else {
push @$errs, "_PATH_LOG not available in syslog.h";
=head1 VERSION
-Version 0.15
+Version 0.16
=head1 SYNOPSIS
A value of C<"unix"> will connect to the UNIX domain socket (in some
systems a character special device) returned by the C<_PATH_LOG> macro
(if your system defines it), or F</dev/log> or F</dev/conslog>,
-whatever is writable. A value of 'stream' will connect to the stream
+whatever is writable. A value of C<"stream"> will connect to the stream
indicated by the pathname provided as the optional second parameter.
(For example Solaris and IRIX require C<"stream"> instead of C<"unix">.)
+A value of C<"native"> will use the native C functions from your C<syslog(3)>
+library.
A value of C<"inet"> will connect to an INET socket (either C<tcp> or C<udp>,
tried in that order) returned by C<getservbyname()>. C<"tcp"> and C<"udp">
can also be given as values. The value C<"console"> will send messages