Log-Fine

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

 * Expand *.pl files
 * Initial entry
 * Add format() example

[2010-11-28]
 * Add MICROSOFT WINDOWS CAVEATS section
 * Closed out formatter tests TODO
 * Place L::F::F::Template tests into separate file
 * Add TODO about breaking up 04-formatter.t tests
 * Overcome MSWin32 strftime(3) deficiencies
 * MSWin32 does not support getgrgid() or getpwuid()

[2010-11-27]
 * Update
 * Match documentation w/ reality
 * Verbiage
 * Bump version

[2010-11-26]
 * Regen
 * Final TODO item about speed

lib/Log/Fine/Formatter/Template.pm  view on Meta::CPAN

        my $self = shift;

        # Should {_userName} be already cached, then return it,
        # otherwise get the user name, cache it, and return
        if (defined $self->{_userName} and $self->{_userName} =~ /\w/) {
                return $self->{_userName};
        } elsif ($self->{use_effective_id}) {
                $self->{_userName} =
                    ($^O eq "MSWin32")
                    ? $ENV{EUID}   || 0
                    : getpwuid($>) || "nobody";
        } else {
                $self->{_userName} = getlogin() || getpwuid($<) || "nobody";
        }

        return $self->{_userName};

}          # _userName()

=head1 MICROSOFT WINDOWS CAVEATS

Under Microsoft Windows operating systems (WinXP, Win2003, Vista,
Win7, etc.), Log::Fine::Formatters::Template will use the following

lib/Log/Fine/Handle/Email.pm  view on Meta::CPAN

        my $self = shift;

        # Should {_userName} be already cached, then return it,
        # otherwise get the user name, cache it, and return
        if (defined $self->{_userName} and $self->{_userName} =~ /\w/) {
                return $self->{_userName};
        } elsif ($self->{use_effective_id}) {
                $self->{_userName} =
                    ($^O eq "MSWin32")
                    ? $ENV{EUID}   || 0
                    : getpwuid($>) || "nobody";
        } else {
                $self->{_userName} = getlogin() || getpwuid($<) || "nobody";
        }

        return $self->{_userName};

}          # _userName()

##
# Default email address checker
#
# Parameters:

t/13-formatter-template.t  view on Meta::CPAN

        # Note we test custom templates twice to see if dynamic
        # content changed
        ok($log_custom->format(INFO, $msg, 0) =~ /^$counter/);
        ok($log_custom->format(INFO, $msg, 0) =~ /^$counter/);

    SKIP: {

                skip "Cannot accurately test user and group placeholders under MSWin32", 2
                    if ($^O =~ /MSWin32/);

                ok($log_user->format(INFO, $msg, 0) eq getpwuid($<));
                ok($log_group->format(INFO, $msg, 0) eq getgrgid((split(" ", $())[0]));

        }

        # Now test a combination string for good measure
        my $log_basic =
            Log::Fine::Formatter::Template->new(template         => "[%%time%%] %%level%% %%msg%%",
                                                timestamp_format => Log::Fine::Formatter->LOG_TIMESTAMP_FORMAT);
        isa_ok($log_basic, "Log::Fine::Formatter::Template");
        can_ok($log_basic, "name");

t/15-handle-email.t  view on Meta::CPAN


        use_ok("Log::Fine::Handle::Email");

        my $email_sender_version = $Email::Sender::VERSION;

        # Load appropriate modules
        require Email::Sender::Simple;
        require Email::Sender::Transport::Test;

        my $user =
            sprintf('%s@localhost', getlogin() || getpwuid($<) || "nobody");

        my $log = Log::Fine->logger("email0");

        isa_ok($log, "Log::Fine");

        # Create a formatter for subject line
        my $subjfmt =
            Log::Fine::Formatter::Template->new(name     => 'email-subject',
                                                template => "%%LEVEL%% : Test of Log::Fine::Handle::Email");

t/16-handle-email-smtp.t  view on Meta::CPAN

                }
        }

        use_ok("Log::Fine::Handle::Email");

        # Load appropriate modules
        require Email::Sender::Simple;
        require Email::Sender::Transport::SMTP;

        my $user =
            sprintf('%s@localhost', getlogin() || getpwuid($<) || "nobody");
        my $log = Log::Fine->logger("email0");

        isa_ok($log, "Log::Fine");

        # Create a formatter for subject line
        my $subjfmt =
            Log::Fine::Formatter::Template->new(name             => 'email-subject',
                                                template         => "%%LEVEL%% : Test of Log::Fine::Handle::Email",
                                                timestamp_format => '%c',
            );



( run in 0.515 second using v1.01-cache-2.11-cpan-8d75d55dd25 )