Rex::Logger(3pm)
π Rex::Logger β the logging module, bestie edition π
okay so this is Rex::Logger, which lives in the Rex::Logger(3pm) part of the User Contributed Perl Documentation, and it's literally the logging module. That's the whole gig. And the best part? You can define your own custom logformats. Obsessed. π
β¨ DESCRIPTION β¨
So like. This module is the logging module. That's it, that's the vibe. The little extra spice is that you get to define custom logformats, so your logs can look however you want them to look. main character log lines only π
πΈ SYNOPSIS πΈ
Here's how the format thing works, fr fr:
$Rex::Logger::format = '[%D] %s';
# will output something like
# [2012-04-12 18:35:12] Installing package vim
$Rex::Logger::format = '%h - %D - %s';
# will output something like
# srv001 - 2012-04-12 18:35:12 - Installing package vim
see how you just stack the little % codes together and the output shapes itself around them? iconic behaviour honestly β¨
π¦ VARIABLES π¦
π $debug
Set this bad boy to 1 and debug logging gets switched on. That's it!
$Rex::Logger::debug = 1;
π $silent
Set this one to 1 and nothing will be logged. Not a single line. Silence. The logs simply β¨do not existβ¨.
$Rex::Logger::silent = 1;
lowkey a dangerous amount of power but go off π«Ά
π $format
This is the one where you get to cook. You define your logging format using these parameters:
%Dβ appends the current date, formatted asyyyy-mm-dd HH:mm:ss%hβ the target host%pβ the pid of the running process%lβ the loglevel (INFOorDEBUG)%sβ the logstring
Default is: [%D] %l - %s
Mix and match those however you like and your logs will serve exactly the look you're going for π
aaaand that's the whole page, bestie! no cap, no missing flags, nothing skipped, we ate π
this was Rex::Logger(3pm) from the User Contributed Perl Documentation, and the page footer says perl v5.40.1, dated 2025-10-03. slay, go forth and log π
π¦ where this page comes from
- ubuntu resolute: rex 1.16.1-1 Β· Apache-2.0
- ubuntu stonking: rex 1.16.1-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms