1package Net::Stomp::StupidLogger; 2use strict; 3use warnings; 4use Carp; 5 6our $VERSION = '0.61'; 7 8sub new { 9 my ($class,$levels) = @_; 10 $levels||={}; 11 for my $l (qw(warn error fatal)) { 12 $levels->{$l}=1 unless defined $levels->{$l}; 13 } 14 return bless $levels,$class; 15} 16 17sub _log { 18 my ($self,$level,@etc) = @_; 19 return unless $self->{$level}; 20 carp join '',@etc; 21} 22 23sub debug { my $self=shift;$self->_log(debug=>@_) } 24sub info { my $self=shift;$self->_log(info =>@_) } 25sub warn { my $self=shift;$self->_log(warn =>@_) } 26sub error { my $self=shift;$self->_log(error=>@_) } 27sub fatal { my $self=shift;$self->_log(fatal=>@_) } 28 291; 30 31__END__ 32 33=head1 NAME 34 35Net::Stomp::StupidLogger - stub logger 36 37=head1 DESCRIPTION 38 39This class implements a very simple logger-like object, that just 40delegates to L<carp|Carp/carp>. 41 42By default, it logs at C<warn> and above. 43 44L<Net::Stomp> used to use this, but now it just uses L<Log::Any>, so 45this package is here just in case someone else was using it. 46 47=head1 METHODS 48 49=head2 new 50 51Constructor. You can pass a hashref with the log levels to enable / 52disable, like: 53 54 Net::Stomp::StupidLogger->new({debug=>1}); # logs debug, warn, 55 # error, fatal 56 57 Net::Stomp::StupidLogger->new({warn=>0}); # logs error, fatal 58 59=head2 debug 60 61=head2 info 62 63=head2 warn 64 65=head2 error 66 67=head2 fatal 68 69 $logger->warn('some',$message); 70 71If the corresponding level is enabled, joins the arguments in a single 72string (no spaces added) and calls L<carp|Carp/carp>. 73 74=head1 AUTHORS 75 76Gianni Ceccarelli <dakkar@thenautilus.net> 77 78=head1 COPYRIGHT 79 80This module is free software; you can redistribute it or modify it 81under the same terms as Perl itself. 82