I have to admit that I'm too busy right now to review your code, but you asked that I reply here to a couple of points from your other thread.
I had to do something like what you describe for a log module I wrote, (although kind of the opposite as you will see). The objective was to retrofit a bunch of existing poorly looged scripts. My idea was to write a module that would allow a simple added use line to cause all activity on STDERR and STDOUT to get redirected to a log file. My approach was to tie STDOUT and STDERR, as well as add traps to $SIG{__WARN__} and $SIG{__DIE__}. (In hindsight overriding CORE::GLOBAL::die() and CORE::GLOBAL::warn() might have been better, but this catches errors from Perl itself, which can be useful.)
This way virtually all output activity is intercepted, regardless if a module is the one that used the logger or not. In fact it probably is simpler than your approach as things like warnings::warn() actually use Carp which in turn use CORE::warn, which is in turn intercepted by the $SIG{__WARN__} handler, likewise for die().
Generally speaking it works well, problems however occur when programs use sneaky ways to get access to the standard filehandles, and when other code installs $SIG{__FOO__} handlers and doesnt behave nicely. The latter is rare, but difficult to deal with as there isnt really a stated "nice" behaviour. For me its been rare enough that it hasnt been an issue. I still wonder when itll bite me though. :-)
Anyway, I still think that arguably the best thing to do in your situation, is write a logfile reader, or a sanitizer of some sort. This is the only real way to address the fact that it will be almost impossible to intercept all writes to the log files in question wheras it is probably feasable to ensure that the files are not read without a tool. But thats not for me to decide is it? :-)
---In reply to Re: Safe::Logs - Feedback appreciated
by demerphq
in thread Safe::Logs - Feedback appreciated
by fokat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |