Rex::Logger(3)

πŸ“¦ version 1.14.3, in nixos 26.05, nixpkgs unstable

πŸ’– Rex::Logger(3) πŸ’–

okay so bestie, welcome to Rex::Logger β€” straight out of the User Contributed Perl Documentation section, and honestly? she's iconic for it. this is the manual page for the logging module, and yes, the vibe is very "your fave little scribe keeping receipts of everything that happens." πŸŽ€


✨ NAME ✨

Rex::Logger β€” the Logging Module. that's it. that's the name. she logs. periodt. πŸ’…


🌸 DESCRIPTION 🌸

this module is the logging module. like, the one. and here's the fun part, bestie: you can define custom logformats. your logs, your rules, your main character energy. πŸ¦‹


🫢 SYNOPSIS 🫢

ok so you set the format like this:

$Rex::Logger::format = '[%D] %s';
# will output something like
# [2012-04-12 18:35:12] Installing package vim

and that'll spit out something like:

[2012-04-12 18:35:12] Installing package vim

orrrr, if you're feeling extra fancy:

$Rex::Logger::format = '%h - %D - %s';
# will output something like
# srv001 - 2012-04-12 18:35:12 - Installing package vim

which gives you:

srv001 - 2012-04-12 18:35:12 - Installing package vim

look at her go πŸ˜­πŸ’–


πŸ‘‘ VARIABLES πŸ‘‘

πŸ’œ $debug

setting this variable to 1 will enable debug logging. yes, all the messy little details get to come to the party. πŸŽ‰

$Rex::Logger::debug = 1;

🧚 $silent

if you set this variable to 1, nothing will be logged. absolutely nothing. silence. ghost mode. not a single peep. πŸ™ˆ

$Rex::Logger::silent = 1;

⭐ $format

you can define the logging format with the following parameters β€” these are the little magic tokens, iykyk:

  • %D β€” appends the current date in yyyy-mm-dd HH:mm:ss format πŸ—“οΈ
  • %h β€” the target host πŸ–₯️
  • %p β€” the pid of the running process πŸ”’
  • %l β€” the loglevel (INFO or DEBUG) πŸ“‹
  • %s β€” the logstring ✍️

and the default is: [%D] %l - %s

ngl bestie, that default is lowkey perfect. don't fix what isn't broken πŸ’…

and that's the whole page, fr fr πŸŒˆπŸ’œ

🌸 sign-off time, bestie 🌸 β€” this gorgeous little doc is from perl v5.42.3, dated 2023-08-05, and it's the Rex::Logger(3) page itself. slay. go forth and log beautifully, bestie πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from