package DoctorKarma::Logger; use Carp; 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; my $critical = shift; openlog ('DoctorKarma', $critical ? '': 'perror', 'user'); syslog ($level, $message); closelog(); } sub log_error { my $self = shift; $self->_log (LOG_ERR, shift); } sub log_critical { my $self = shift; my $error = shift; $self->_log (LOG_ERR, $error, 1); confess $error; } sub log_info { my $self = shift; $self->_log (LOG_INFO, shift); } 1;