preaction / Log-Any

Simple, fast Perl logging API compatible with any logging system
Other
13 stars 19 forks source link

Capture adapter, for redirecting messages to a callback/arrayref #77

Closed nrdvana closed 5 years ago

nrdvana commented 5 years ago

This adapter is much like the 'Test' adapter, but is intended for end users. It can log to an arrayref or a coderef, and has several convenient options that allow capturing the entire structured form of a message, or just the text. It supports a log_level filter as well.

I've been using a simpler version of this in my projects for a long time, specifically for the cases where a web request runs and calls out to a module which uses Log::Any but then I want the client to see the log messages rather than have them go to the webserver log file.

preaction commented 5 years ago

Wow, that's really nice. I can see this being incredibly useful for testing as well: It's much less magical than the Test adapter. I might end up replacing the Test adapter with this one :) Thanks!