- BUGS AND LIMITATIONS
- SEE ALSO
- COPYRIGHT AND LICENSE
Tie::Handle::Filter::Output::Timestamp::EveryLine - prepend every line of filehandle output with a timestamp
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
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
say (in Perl > v5.10).
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.
Because the date and time format is specified using
strftime, portable code should restrict itself to formats using ANSI C89 specifiers.
Mark Gardner <email@example.com>
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.