source: ocsinventory-agent/trunk/fuentes/lib/Ocsinventory/LoggerBackend/Syslog.pm @ 468

Last change on this file since 468 was 468, checked in by mabarracus, 4 years ago

Copyt trusty code

File size: 549 bytes
Line 
1package Ocsinventory::LoggerBackend::Syslog;
2# Not tested yet!
3use Sys::Syslog qw( :DEFAULT setlogsock);
4
5sub new {
6  my (undef, $params) = @_;
7
8  my $self = {};
9
10  setlogsock('unix');
11  openlog("ocs-agent", 'cons,pid', $ENV{'USER'});
12  syslog('debug', 'syslog backend enabled');
13  closelog();
14
15  bless $self;
16}
17
18sub addMsg {
19
20  my (undef, $args) = @_;
21
22  my $level = $args->{level};
23  my $message = $args->{message};
24
25  return if $message =~ /^$/;
26
27  openlog("ocs-agent", 'cons,pid', $ENV{'USER'});
28  syslog('info', $message);
29  closelog();
30
31}
32
331;
Note: See TracBrowser for help on using the repository browser.