Log-YetAnother
view release on metacpan or search on metacpan
lib/Log/YetAnother.pm view on Meta::CPAN
};
return bless $self, $class; # Bless and return the object
}
# Internal method to log messages. This method is called by other logging methods.
# $logger->_log($level, @messages);
sub _log {
my ($self, $level, @messages) = @_;
if(!UNIVERSAL::isa((caller)[0], __PACKAGE__)) {
Carp::croak('Illegal Operation: This method can only be called by a subclass');
}
# Push the message to the internal messages array
push @{$self->{messages}}, { level => $level, message => join(' ', grep defined, @messages) };
if(my $logger = $self->{logger}) {
if(ref($logger) eq 'CODE') {
# If logger is a code reference, call it with log details
$logger->({
( run in 1.723 second using v1.01-cache-2.11-cpan-1e74a51a04c )