DoctorKarma/lib/DoctorAgustin/Logger.pm

31 lines
475 B
Perl
Raw Normal View History

2022-02-04 20:43:32 +01:00
package DoctorAgustin::Logger;
use Sys::Syslog;
sub new {
my $class = shift;
my $self = bless {}, $class;
return $self;
}
sub _log {
my $self = shift;
my $level = shift;
my $message = shift;
openlog ('Doctor Agustín: ', 'perror', 'user');
syslog ($level, $message);
closelog();
}
sub log_error {
my $self = shift;
$self->_log (LOG_ERR, shift);
}
sub log_info {
my $self = shift;
$self->_log (LOG_INFO, shift);
}
1;