NAME

Log::ger::Manual::Tutorial::700_Layout - Layout plugins

VERSION

version 0.033.000

DESCRIPTION

WHAT IS A LAYOUT PLUGIN?

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

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2020, 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.