NAME

Tie::Handle::Filter::Output::Timestamp::EveryLine - prepend every line of filehandle output with a timestamp

VERSION

version 0.011

SYNOPSIS

    use Tie::Handle::Filter::Output::Timestamp::EveryLine;
    tie *STDOUT, 'Tie::Handle::Filter::Output::Timestamp::EveryLine', *STDOUT;

    print "Everything I print will be prepended with a timestamp.\n";
    print <<'END_OUTPUT';
    Even multi-line output will have every line prepended.
    Including this one.
    END_OUTPUT

DESCRIPTION

This class may be used with Perl's tie function to prepend all output with a timestamp, optionally formatted according to the POSIX strftime function. Unlike Tie::Handle::Filter::Output::Timestamp, every line gets a timestamp, rather than just the beginning of strings given to print, printf, syswrite, and say (in Perl > v5.10).

METHODS

TIEHANDLE

Invoked by the command tie *glob, 'Tie::Handle::Filter::Output::Timestamp', *glob. You may also specify a strftime string as an additional parameter to format the timestamp; by default the format is %x %X , which is the local representation of the date and time followed by a space.

EXTENDS

REQUIRES

BUGS AND LIMITATIONS

Because the date and time format is specified using strftime, portable code should restrict itself to formats using ANSI C89 specifiers.

SEE ALSO

PerlIO::via::Logger, which offers a PerlIO-based logging layer and may be slightly faster.

AUTHOR

Mark Gardner <mjgardner@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2016 by cPanel, Inc.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.