Dancer2...e::Trap(3)

πŸ’– Dancer2::Logger::Capture::Trap(3) πŸ’–

User Contributed Perl Documentation Β· Dancer2::Logger::Capture::Trap(3)

okay bestie sit DOWN because this one is short and sweet and honestly kind of iconic πŸ’…


✨ NAME ✨

Dancer2::Logger::Capture::Trap β€” it's literally just a lil place to store captured Dancer2 logs πŸŽ€


🌸 VERSION 🌸

version 2.2.1


πŸ¦‹ SYNOPSIS πŸ¦‹

my $trap = Dancer2::Logger::Capture::Trap->new;
$trap->store( $level, $message );
my $logs = $trap->read;

that's it. that's the whole vibe. new one up, toss logs in, pull logs out. slay ✨


πŸ’œ DESCRIPTION πŸ’œ

so like… this is a place to store and retrieve capture Dancer2 logs 🫢 it's the little storage buddy that Dancer2::Logger::Capture uses to keep its receipts. no cap, that's genuinely the whole job.

πŸŽ€ Methods πŸŽ€

new

makes you a fresh trap, bestie. brand new, zero logs, immaculate energy πŸ‘‘

store

$trap->store($level, $message);

Stores a log $message and its $level. two little args, both doing their part, main character energy fr fr πŸ’…

read

my $logs = $trap->read;

Returns the logs stored as an array ref and β€” heads up, this is the important bit β€” clears the storage 😭 like, it reads them and then it's like "okay bye, gone, empty." so if you read twice, the second read gets nothing. no notes, that's just how it works.

For example...

[{ level => "warning", message => "Danger! Warning! Dancer2!" },
 { level => "error",   message => "You fail forever" }
];

look at that structure. level and message keys, one hash per log, in a tidy array ref. we love a consistent format πŸ“


🌈 SEE ALSO 🌈

  • Dancer2::Logger::Capture β€” the bestie that actually does the capturing, this page is just its storage unit 🧚

πŸ‘‘ AUTHOR πŸ‘‘

Dancer Core Developers β€” legends, honestly.


This software is copyright (c) 2026 by Alexis Sukrieh.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. free free free, as it should be 🫢


and that's the whole page, bestie!! perl v5.42.3, dated 2026-09-20 β€” go forth and capture those logs πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from