Log::ger::Manual::Tutorial::07_Layout - Layout plugins
version 0.028.000
A layout plugin provides code to modify a log message (usually decorate, add more information) after it is formatted by the formatter. This functionality is separated from formatter plugin for more flexibility.
Most of the time, the layout plugin that you might want to use is Log::ger::Layout::Pattern. This plugin is similar to the pattern layout module Log::Log4perl::Layout::PatternLayout in Log::Log4perl. In fact, most of the placeholders follow the Log4perl version. This plugin lets you add extra information like timestamp, PID, category name, level name, and so on to the log message, aside from the log message itself.
For example:
use Log::ger::Layout Pattern => (format => '[%d][%c]%% %m'); use Log::ger::Output 'Screen'; use Log::ger; log_warn("a warning");
will print something like:
[2017-08-03T14:51:18][main]% a warning
perlancar <perlancar@cpan.org>
This software is copyright (c) 2019, 2018, 2017 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Log::ger::Manual, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Log::ger::Manual
CPAN shell
perl -MCPAN -e shell install Log::ger::Manual
For more information on module installation, please visit the detailed CPAN module installation guide.