Log::ger::Manual::Tutorial::700_Layout - Layout plugins
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.
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
This software is copyright (c) 2020, 2019, 2018, 2017 by firstname.lastname@example.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.