Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Is there some standard for logging from within the modules?

by Sixtease (Friar)
on Nov 17, 2009 at 09:31 UTC ( #807637=note: print w/replies, xml ) Need Help??


in reply to Is there some standard for logging from within the modules?

I have just come across the same problem. The way I solved it is that I simply created a log method in my module and I pass the messages to it. The method stores the messages in the object.

It is fairly easy for users to redefine the method (directly or by subclassing).

sub log { my ($self, $msg) = @_; push @{ $self->{log} }, { timestamp => time, message => $msg, }; } sub foo { my ($self) = @_; $self->log('Entered foo'); }
use strict; use warnings; print "Just Another Perl Hacker\n";

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://807637]
help
Chatterbox?
[atcroft]: Lady_Aleena: I found the L<name|section> syntax, which describes linking to a perl manual page, and L<text|url> to link to a web page. The reason I asked was because I was on search.cpan.org looking at a module,
[atcroft]: and it referred to several other modules, but the links went to metacpan.org. I found that a bit of a surprise, and it got me wondering if there was a "standard" way to link to other modules in the documentation on CPAN.
[Lady_Aleena]: atcroft. maybe look at raw PODs. There is also L<foo|http://foo. com> and some might be linking directly to meta::cpan.
[Lady_Aleena]: Oops, didn't read the L<text|url> right.

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2017-05-27 03:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?