The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Test2::Plugin::IOMuxer - Send STDERR and STDOUT output to a single file in addition to the original, including timestamp markers.

DESCRIPTION

It is essentially impossible to merge STDOUT and STDERR after the fact. It is also impossible to split them out if they are initially written to the same distination (redirecting STDERR to STDOUT). This plugin will have STDERR and STDOUT go to their normal locations, but will also copy all the output to a single combined file. The combined file will include timestamps, and everything will be muxed together in the right order.

CAVEAT: When you run a command with system() the output is sent directly to STDOUT and STDERR, so the muxing does not apply. That output needs to be manually mixed back in if needed.

COMBINING WITH IOEVENTS

If you decide to use this plugin along with Test2::Plugin::IOEvents you should load IOMuxer first, and then IOEvents.

Or you could simply use Test2::Plugin::IOSync instead of loading both modules yourself.

SYNOPSIS

Simply loading the plugin with a path to a filename will mux STDOUT and STDERR (as well as formatter output in most cases) into that destination file.

    use Test2::Plugin::IOMuxer '/path/to/muxed/file.txt';

You can instead manually mux the handles you are interested in:

    use Test2::Plugin::IOMuxer qw/mux_handle/;

    mux_handle(STDOUT, '/path/to/muxed/file.txt');
    mux_handle(STDERR, '/path/to/muxed/file.txt');

Please note that this will not effect the handles for most formatters.

SOURCE

The source code repository for Test2-Plugin-IOSync can be found at http://github.com/Test-More/Test2-Plugin-IOSync/.

MAINTAINERS

Chad Granum <exodist@cpan.org>

AUTHORS

Chad Granum <exodist@cpan.org>

COPYRIGHT

Copyright 2017 Chad Granum <exodist@cpan.org>.

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

See http://dev.perl.org/licenses/