Difference between revisions of "Esmith::Logger"
From SME Server
Jump to navigationJump to search (Created page with "esmith::Logger(3) User Contributed Perl Documentation esmith::Logger(3) ===NAME=== esmith::Logger - A filehandle abstraction around Syslog. ===SYNOPSIS=== ...") |
|||
Line 6: | Line 6: | ||
===SYNOPSIS=== | ===SYNOPSIS=== | ||
use esmith::Logger; | use esmith::Logger; | ||
− | + | ||
tie *FH, 'esmith::Logger'; | tie *FH, 'esmith::Logger'; | ||
print FH "log message"; | print FH "log message"; | ||
close FH; | close FH; | ||
+ | |||
+ | you can do a function | ||
+ | use esmith::Logger; | ||
+ | #we create a function because we want to write in log | ||
+ | sub log2messages | ||
+ | { | ||
+ | my $message = shift; | ||
+ | tie *FH, 'esmith::Logger'; | ||
+ | print FH "$message"; | ||
+ | close FH; | ||
+ | } | ||
+ | and now in your code if you want to use it | ||
+ | log2messages("Your error message"); | ||
+ | |||
[[Category:Developer]] | [[Category:Developer]] |
Latest revision as of 23:01, 16 January 2015
esmith::Logger(3) User Contributed Perl Documentation esmith::Logger(3)
NAME
esmith::Logger - A filehandle abstraction around Syslog.
SYNOPSIS
use esmith::Logger; tie *FH, 'esmith::Logger'; print FH "log message"; close FH;
you can do a function
use esmith::Logger; #we create a function because we want to write in log sub log2messages { my $message = shift; tie *FH, 'esmith::Logger'; print FH "$message"; close FH; }
and now in your code if you want to use it
log2messages("Your error message");