POE::Declare::Log::File - A simple HTTP client based on POE::Declare
# Create the web server my $http = POE::Declare::Log::File->new( Filename => '/var/log/my.log', Lazy => 1, ); # Control with methods $http->start; $http->GET('http://google.com'); $http->stop;
This module provides a simple logging module which spools output to a file, queueing and batching messages in memory if the message rate exceeds the responsiveness of the filesystem.
The implementation is intentionally minimalist and has no dependencies beyond those of POE::Declare itself, which makes this module useful for simple utility logging or debugging systems.
my $server = POE::Declare::Log::File->new( Filename => ShutdownEvent => \&on_shutdown, );
The new constructor sets up a reusable HTTP client that can be enabled and disabled repeatedly as needed.
new
The start method enables the web server. If the server is already running, this method will shortcut and do nothing.
start
If called before POE has been started, the web server will start immediately once POE is running.
The stop method disables the web server. If the server is not running, this method will shortcut and do nothing.
stop
$log->print("This is a log message");
Writes one or more messages to the log.
Returns true if the message will be flushed to the file immediately, false if the message will be queued for later dispatch, or undef if the logger is disabled and the message will be dropped.
undef
Bugs should be always be reported via the CPAN bug tracker at
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=POE-Declare-Log-File
For other issues, or commercial enhancement or support, contact the author.
Adam Kennedy <adamk@cpan.org>
POE::Declare, POE, http://ali.as/
Copyright 2011 Adam Kennedy.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
To install POE::Declare::Log::File, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POE::Declare::Log::File
CPAN shell
perl -MCPAN -e shell install POE::Declare::Log::File
For more information on module installation, please visit the detailed CPAN module installation guide.