如何在Perl模块中包含日志记录?

前端之家收集整理的这篇文章主要介绍了如何在Perl模块中包含日志记录?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想在我正在编写的Perl模块中包含日志记录,但是要保持可移植性,以便使用它的应用程序不会绑定到特定的日志记录机制,例如 Log::Log4Perl.

我考虑过了;

>登录到STDERR并将其留给应用程序将这些消息重定向到它自己的日志记录机制(如Log::Log4Perl FAQ中所述).
>根本不包括登录模块.

我怀疑有更好的方法.

@H_301_10@解决方法
Log::Any

Log::Any allows CPAN modules to safely and efficiently log messages,while letting the application choose (or decline to choose) a logging mechanism such as Log::Dispatch or Log::Log4perl.

原文链接:https://www.f2er.com/Perl/241702.html

猜你在找的Perl相关文章