Parano...g::File(3pm)

πŸ“¦
version 2.10 Β· 3 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ’– Paranoid::Log::File β€” the Perl doc for it, bestie πŸ’–

okay so this is the page for Paranoid::Log::File, coming at you from the User Contributed Perl Documentation section (section 3pm, for the perl girlies who like their manpages numbered). It's giving "logging but make it paranoid" and honestly? iconic. πŸŽ€


✨ VERSION ✨

$Id: lib/Paranoid/Log/File.pm, 2.10 2022/03/08 00:01:04 acorliss $

that's the version string, copy it into your bug report verbatim or it doesn't count πŸ’…


✨ SYNOPSIS ✨

use Paranoid::Log;

startLogger('events', 'File', PL_DEBUG, PL_GE,
  {
    file   => '/var/log/events.log',
    mode   => O_TRUNC | O_CREAT | O_RDWR,
    perm   => 0600,
    syslog => 1,
  });

literally the whole vibe in six lines. look at that option hash. she's perfect. πŸ¦‹


✨ DESCRIPTION ✨

so basically this lets you log to log files. that's the whole thing. it will happily log text of arbitrarily long length β€” no cap, fr fr β€” but it also has a syslog mode, which is a whole different girl: that one caps your log lines at 2048 and slaps the standard syslog preamble in front of your text (date/time, host, process name/PID). cute.

The only mandatory option is the file key/value pair. that's it. everything else has a default and she will absolutely pick it for you. 🫢

This module leverages Paranoid::IO's popen. yes bestie, it's reusing the infrastructure, we love a collaboration.

mode defaults to O_CREAT | O_APPEND | O_WRONLY

perm defaults to 0666 ^ UMASK

syslog defaults to false. Enabling it causes every line to be formatted akin to syslog, along with the 2048 byte limit on messages. so if you turn it on, expect the format glow-up and the length restriction. no cap.


✨ OPTIONS ✨

these are the keys you can put in the options hash, bestie. here's the lineup πŸŽ€

  • file β€” string β€” file name of log file πŸ“
  • mode β€” integer β€” file mode to open with
  • perm β€” integer β€” file permissions of newly created log files πŸ”
  • syslog β€” boolean β€” enable syslog-style format ✨
reminder: file is the only one you have to give her. the rest are optional and will fall back to their defaults.

✨ SUBROUTINES/METHODS ✨

NOTE: Given that this module is not intended to be used directly nothing is exported.

that's the note, and it's important β€” don't try to import things from here, she's not that kind of module. πŸ™ˆ

  • init
  • logMsg
  • addLogger
  • delLogger

✨ DEPENDENCIES ✨

she does not come alone, she comes with a friend group:

  • Fcntl
  • Paranoid::Debug
  • Paranoid::Filesystem
  • Paranoid::Input
  • Paranoid::IO

✨ SEE ALSO ✨

  • Paranoid::Log

go read that one too, bestie, it's the main character and this one is her supporting cast πŸ’œ


✨ BUGS AND LIMITATIONS ✨

okay let's be real for a sec. 🫢

This isn't a high performance module when dealing with a high logging rate with high concurrency. why? the advisory locking requirement and the seeks to the end of the file with every message. every. single. message. so if you're throwing a million logs a second at her with fifty processes, she's gonna be sweating. 😭

This facility is intended as a kind of lowest-common denominator for programs that need some kind of logging capability. that's the brief. that's the assignment. she's not here to be a speed demon, she's here to be available.


✨ AUTHOR ✨

Arthur Corliss (corliss@digitalmages.com)


This software is free software. Similar to Perl, you can redistribute it and/or modify it under the terms of either:

  1. the GNU General Public License https://www.gnu.org/licenses/gpl-1.0.html as published by the Free Software Foundation http://www.fsf.org/; either version 1 https://www.gnu.org/licenses/gpl-1.0.html, or any later version https://www.gnu.org/licenses/license-list.html#GNUGPL, or
  2. the Artistic License 2.0 https://opensource.org/licenses/Artistic-2.0,

subject to the following additional term: No trademark rights to "Paranoid" have been or are conveyed under any of the above licenses. However, "Paranoid" may be used fairly to describe this unmodified software, in good faith, but not as a trademark.

(c) 2005 - 2020, Arthur Corliss (corliss@digitalmages.com) (tm) 2008 - 2020, Paranoid Inc. (www.paranoid.com)


and that's the whole page, bestie!! πŸ’– the footer said perl v5.38.2 and a date of 2024-03-07, and the title up top was Parano...g::File(3pm) (yes the header truncates the name like that, she's got a character limit and she's abiding by it). mwah, go log something responsibly. πŸŒˆβœ¨πŸ‘‘

πŸ“¦ where this page comes from