POE::Co...:Logger(3)

πŸ“¦
version 1.10 Β· 2 versions
, in fedora 43

πŸ’– POE::Co...:Logger(3) πŸ’–

okay bestie, so this is the manual page for POE::Component::Logger, straight out of the User Contributed Perl Documentation. It's a POE logging class, and honestly? It's giving "small but mighty." πŸŽ€


✨ NAME ✨

POE::Component::Logger β€” a POE logging class. That's it, that's the whole vibe. πŸ¦‹


🌸 SYNOPSIS 🌸

First, in your startup code somewhere:

POE::Component::Logger->spawn(ConfigFile => 'log.conf');

And then later, whenever, inside an event handler:

Logger->log("Something happened!");

That's literally it. Two lines. Slay. πŸ’…


πŸ’œ DESCRIPTION πŸ’œ

So here's the tea: POE::Component::Logger hands you a simple logging component, and it uses Log::Dispatch::Config to drive the whole thing. Which means β€” and this is the iconic part β€” you can log to multiple places at once (like, to STDERR and Syslog at the same time, no cap ✨) and you can flexibly define what your logger's output even looks like.

It's very simple to use, because it goes ahead and creates a Logger::log method for you. Yes, this is namespace corruption, so shoot me. πŸ™ˆ If you don't vibe with that, feel free to post directly to your logger like this instead:

$kernel->post('logger', 'log', "An error occurred: $!");

And actually β€” you have to use that method if you pass an Alias option to spawn (peep below πŸ‘‡).

Big important thing: all logging is done in the background, so do not expect immediate output, bestie. 😭 The output will only occur after control goes back to the kernel so it can process the next event. Patience is the moment. 🧘


πŸ‘‘ OPTIONS and METHODS πŸ‘‘

🌈 spawn

The spawn class method can take two options.

  • The required ConfigFile option β€” it specifies the location of the config file as passed to Log::Dispatch::Config's configure() method. (note that you can also use an object here, see Log::Dispatch::Config for more details πŸ‘€)
  • The other available option is Alias, which you use if you wish to have more than one logger in your POE application.
Careful though: if you specify an alias other than the default 'logger' alias, you will not be able to use the Logger->log shortcut, and will have to use direct method calls instead. fr fr. πŸ’€

πŸ¦‹ Logger->log / POE::Component::Logger->log

This is what you use to perform a logging action. You may either pass a string, or a hashref.

  • If you pass in a string, it is logged at the level specified in $POE::Component::Logger::DefaultLevel, which is 'warning' by default.
  • If you pass in a hashref, it is expanded as a hash and passed to Log::Dispatch's log() method.

Pick your fighter. Both are valid. ✨


⭐ LOGGING STATES ⭐

The following states are available on the POE logging session:

πŸŽ€ log

Same as Logger->log(), except you may use a different alias if posting direct to the kernel, for example:

$kernel->post( 'error.log', 'log', "Some error");
$kernel->post( 'access.log', 'log', "Access Details");

πŸ’œ debug

And also notice, info, warning, error, critical, emergency and alert. 🫢

These states simply log at a different level. See Log::Dispatch for further details.


πŸ”₯ EXAMPLE CONFIG FILE πŸ”₯

# logs to screen (STDERR) and syslog
dispatchers = screen syslog

[screen]
class = Log::Dispatch::Screen
min_level = info
stderr = 1
format = %d %m %n

[syslog]
class = Log::Dispatch::Syslog
min_level = warning

Copy that, paste that, it's iconic. πŸ’…


🌸 SUPPORT 🌸

You can look for information at:

  • RT: CPAN's request tracker

<http://rt.cpan.org/NoAuth/Bugs.html?Dist=POE-Component-Logger>: post bug report there.

  • CPAN Ratings

<http://cpanratings.perl.org/p/POE-Component-Logger>: if you use this distibution, please add comments on your experience for other users.

  • Search CPAN

<http://search.cpan.org/dist/POE-Component-Logger/>

  • GitHub

<http://github.com/dolmen/POE-Component-Logger>: the source code repository.

Go be a main character and file that bug report, bestie. 🫢


πŸ’– AUTHORS πŸ’–

Matt Sergeant, "matt@sergeant.org".

Olivier MenguΓ©, "dolmen@cpan.org".

Legends, both of them. πŸ‘‘


Copyright Β© 2002 Matt Sergeant.

Copyright Β© 2010 Olivier MenguΓ©.

This is free software. You may use it and redistribute it under the same terms as Perl itself.


πŸ¦‹ SEE ALSO πŸ¦‹

  • Log::Dispatch
  • Log::Dispatch::Config
  • AppConfig
  • POE

okay that's the whole page, mwah πŸ’‹ β€” this was perl v5.42.0, dated 2025-07-25, and you read it all the way through so honestly? you ate. no crumbs. periodt. πŸŽ€βœ¨

πŸ“¦ where this page comes from