http://qs321.pair.com?node_id=1212942


in reply to Re^2: Override printing to STDOUT/ERR
in thread Override printing to STDOUT/ERR

You may want to consider using on of the logging frameworks, available on CPAN, as opposed to a print based approach

Log::Log4perl, Log::Any, Log::ger are examples that support directing output of the log statements to different locations based upon a category. A category is generally a package but can be explicitly set as desired.

Here an example from the Log::ger::Manual::Tutorial::05_Category tutorial

use Log::ger::Output Composite => ( outputs => { File => [ { conf => {path=>'/path/app.log'}, category_level => { Foo => 'off' }, }, { conf => {path=>'/path/foo.log'}, level => 'off', category_level => { Foo => 'trace' }, }, ], }, );

lbe