Debbugs::Log(3pm)

πŸ’– NAME πŸ’–

Debbugs::Log β€” bestie, it's an interface to debbugs .log files πŸ’…


🌸 DESCRIPTION 🌸

Okay so listen β€” the Debbugs::Log module is literally the convenient lil way for your scripts to read and write the .log files that debbugs uses to store the complete textual records of all bug transactions. Iconic archival behavior, no cap. ✨

But here's the tea, and it's important: Debbugs::Log does not decode utf8 into perl's internal encoding, and it does not encode into utf8 from perl's internal encoding. For html records and all recips, this should probably be done. For other records, this should not be needed. So like… know that about her 🫢


πŸ“Ό The .log File Format πŸ“Ό

So .log files are just a sequence of records, and each record is one of the following four types. And when we say ^A, ^B, etc.? Those represent the actual control characters, bestie. Fr fr.

  • incoming-recv
^G
[mail]
^C

So [mail] must start with /^Received: \(at \S+\) by \S+;/, and then it gets copied to the output. Simple as that πŸ’…

  • autocheck

Auto-forwarded messages are recorded like this:

^A
[mail]
^C

And [mail] must contain /^X-Debian-Bugs(-\w+)?: This is an autoforward from \S+/. The first line matching that gets removed, and then every line in the message body that begins with 'X' gets copied to the output β€” minus the 'X' itself. Sneaky lil transformation, iykyk 🌈

⚠️ Real talk: nothing in debbugs actually generates this record type any more, but it may still be hanging around in old .logs at some sites. Vintage queen behavior.
  • recips
^B
[recip]^D[recip]^D[...] OR -t
^E
[mail]
^C

Each [recip] is output after "Message sent". And "-t" represents the same sendmail option, indicating that the recipients are taken from the headers of the message itself πŸ‘‘

  • html
^F
[html]
^C

[html] is copied unescaped to the output. And the record immediately following this one is considered "boring" and only shown in certain output modes πŸ™ˆ

πŸ’€ (This is a design flaw in the log format, since it makes it difficult to change the HTML presentation later, or to present the data in an entirely different format.)

And that's the whole menu β€” no other types of records are permitted, and the file must end with a ^C line. Periodt. πŸŽ€


🧚 Perl Record Representation 🧚

Each record is a hash, bestie. The "type" field is "incoming-recv", "autocheck", "recips", or "html" as above; "text" contains text from "[mail]" or "[html]" as above; and "recips" is a reference to an array of recipients (strings), or undef for "-t". Slay ✨


✨ FUNCTIONS ✨

  • new β€” Creates a new log reader based on a .log filehandle. Look at her go:
my $log = Debbugs::Log->new($logfh);
my $log = Debbugs::Log->new(bug_num => $nnn);
my $log = Debbugs::Log->new(logfh => $logfh);

Parameters

  • bug_num β€” bug number
  • logfh β€” log filehandle
  • log_name β€” name of log
πŸ‘‘ One of the above options must be passed. That's the vibe check.
  • read_record β€” Reads and returns a single record from a log reader object. At end of file, returns undef. Throws exceptions using die(), so you may want to wrap this in an eval() 😭 (yes the eval is load-bearing, bestie)
  • read_log_records β€” Takes a .log filehandle as input, and returns an array of all records in that file. Throws exceptions using die(), so you may want to wrap this in an eval() too 🫢

Uses exactly the same options as Debbugs::Log::new

  • write_log_records β€” Takes a filehandle and a list of records as input, and prints the .log format representation of those records to that filehandle. Go off, writer girl πŸ’…

πŸ”₯ escape_log πŸ”₯

print {$log} escape_log(@log)

Applies the log escape regex to the passed logfile. That's it, that's the function 🌸


🫢 CAVEATS 🫢

So this module does none of the formatting that bugreport.cgi et al do. Ngl, it's simply a means for extracting and rewriting raw records. Raw data only, no glow-up included πŸ’œ


And that's the whole page, bestie! 🌈 This lil manual came to you from perl v5.40.1, dated 2026-04-27, and it's part of the User Contributed Perl Documentation collection. Go read some .log files, you main character πŸ’…πŸ’–

πŸ“¦ where this page comes from