Plack:...:LogAny(3pm)

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

πŸ’– Plack::Middleware::LogAny β€” the manual, but make it cute πŸ’–

okay bestie, so this is the page for Plack::Middleware::LogAny (perl v5.38.2, dated 2024-08-03, in case the vibe check requires receipts ✨). It's a Plack middleware that hands your PSGI app's logging over to Log::Any, and honestly? It's giving main character energy. πŸ‘‘


✨ NAME ✨

Plack::Middleware::LogAny β€” use Log::Any to handle logging from your PSGI application. No cap, that's the whole thing. πŸŽ€


✨ SYNOPSIS ✨

Okay so here's how you'd actually use it. First, in your app.psgi file:

# in app.psgi file
use Plack::Builder;

Then you've got your PSGI application, like the girlboss you are:

# PSGI application
my $app = sub { ... };

Now β€” the DSL interface, which is the slay way to do it:

# DSL interface
builder {
  enable 'LogAny', category => 'plack', context => [ qw( X-Request-ID ) ];
  $app;
}

Or if you're feeling more OO about it, there's an alternative interface too:

# alternative OO interface
Plack::Middleware::LogAny->wrap( $app, category => 'plack', context => [ qw( X-Request-ID ) ] );

Periodt. πŸ’…


✨ DESCRIPTION ✨

So LogAny is a Plack::Middleware component that lets you use Log::Any to handle the psgix.logger logging object. πŸ¦‹

That object? It's a code reference, and it's described over in PSGI::Extensions. Iykyk. πŸ’–


✨ METHODS ✨

🌸 prepare_app()

This method initializes the logger using the category that you optionally set. Cute, right? ✨

🌸 call()

This method sets the logging object and the logging context. The logging context is localized. πŸŽ€


✨ CONFIGURATION OPTIONS ✨

  • category β€” the Log::Any category to send logs to. It defaults to '', which means it sends to the root logger. 🌈
  • context β€” as of release 0.002 πŸ‘€ β€” a list of HTTP header names that gets passed from the PSGI environment to the Log::Any logging context. πŸ’œ

✨ AUTHOR ✨

Sven Willenbuecher <sven.willenbuecher@kuehne-nagel.com> 🫢


This software is copyright (c) 2012 by Michael Alan Dorman. πŸ‘‘

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


✨ SEE ALSO ✨

  • Log::Any πŸ’–

And that's the whole page, bestie β€” perl v5.38.2, dated 2024-08-03, brought to you by the good folks of the User Contributed Perl Documentation. Slay, stay logged, and remember to localize your context. πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from