[dancer-users] Best way to log from wherever?
andy at andybev.com
Tue Jan 5 11:12:11 EST 2021
On Tue, 5 Jan 2021 02:06:59 -0600 Aaron Hall wrote:
> What is the current thinking on the "best" or "right" way to log from
> all parts of your program?
My preferred way is to use Log::Report throughout applications. There
is no dependency on Dancer, so you can use consistent logging
in all your modules, and then there is a Dancer plugin which integrates
with the Dancer logging ecosystem.
Log::Report is very powerful and as such can be a bit difficult to get
your head round initially; on the flipside, however, it will almost
certainly do anything you need in the future. Some of its features
- Language translations
- Different "dispatchers" for sending messages to
- Different classes for messages
- Different logging levels for exceptions
- Options to pipe specific messages to different logging dispatchers
The pod for Dancer2::Plugin::LogReport is well worth a read:
It's also possible to use Log::Report::Optional in all your modules,
which will then only use the full Log::Report if it has been loaded by
the main application, thereby keeping dependencies to a minimum.
Feel free to ask any questions about its functionality here.
More information about the dancer-users