| 1 |
NAME |
| 2 |
Logger::Simple - Implementation of the Simran-Log-Log and |
| 3 |
Simran-Error-Error modules |
| 4 |
|
| 5 |
SYNOPSIS |
| 6 |
use Logger::Simple; |
| 7 |
my $log=Logger::Simple->new(LOG=>"/tmp/program.log"); |
| 8 |
my $x=5;my $y=4; |
| 9 |
|
| 10 |
if($x>$y){ |
| 11 |
$log->write("\$x is greater than \$y"); |
| 12 |
} |
| 13 |
|
| 14 |
DESCRIPTION |
| 15 |
new "my $log=Logger::Simple->new(LOG=>"/tmp/logfile");" |
| 16 |
|
| 17 |
The new method creates the Logger::Simple object as an inside-out |
| 18 |
object. The Log parameter is a mandatory one that must be passed to |
| 19 |
the object at creation, or the object will fail. Upon creation, |
| 20 |
this method will also call the open_log method which opens the log |
| 21 |
file. |
| 22 |
|
| 23 |
write |
| 24 |
"$log->write("This is an error message");" |
| 25 |
|
| 26 |
This method will write a message to the logfile, and will update |
| 27 |
the internal HISTORY array. |
| 28 |
|
| 29 |
retrieve_history |
| 30 |
"my @history = $log->retrieve_history;" |
| 31 |
"my $msg = $log->retrieve_history;" |
| 32 |
|
| 33 |
When called in scalar context, it will return the last message |
| 34 |
written to the HISTORY array. When called in a list context, it |
| 35 |
will return the entire HISTORY array |
| 36 |
|
| 37 |
clear_history |
| 38 |
"$log->clear_history;" |
| 39 |
|
| 40 |
This method will clear the internal HISTORY array |
| 41 |
|
| 42 |
EXPORT |
| 43 |
None by default. |
| 44 |
|
| 45 |
ACKNOWLEDGEMENTS |
| 46 |
This module is based on the Simran::Log::Log and Simran::Error::Error |
| 47 |
modules. I liked the principle behind them, but felt that the interface |
| 48 |
could be a bit better. |
| 49 |
|
| 50 |
My thanks also goes out once again to Damian Conway for Object Oriented |
| 51 |
Perl, and also to Sam Tregar, for his book "Writing Perl Modules for |
| 52 |
CPAN". Both were invaluable references for me. |
| 53 |
|
| 54 |
I would also like to thank Jerry Heden for his Object::InsideOut module, |
| 55 |
which I used to create this module. |
| 56 |
|
| 57 |
AUTHOR |
| 58 |
Thomas Stanley |
| 59 |
|
| 60 |
[email protected] |
| 61 |
|
| 62 |
I can also be found on http://www.perlmonks.org as TStanley. You can |
| 63 |
also direct any questions concerning this module there as well. |
| 64 |
|
| 65 |
COPYRIGHT |
| 66 |
Copyright (C) 2002-2006 Thomas Stanley. All rights reserved. This program is free software; you can distribute it and/or modify it under the same terms as Perl itself. |
| 67 |
|
| 68 |
SEE ALSO |
| 69 |
perl(1). |
| 70 |
|
| 71 |
Object::InsideOut |
| 72 |
|
| 73 |
Simran::Log::Log |
| 74 |
|
| 75 |
Simran::Error::Error |
| 76 |
|