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

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

Copyt trusty code

File size: 556 bytes
Line 
1package Ocsinventory::LoggerBackend::Stderr;
2
3sub new {
4  my (undef, $params) = @_;
5
6  my $self = {};
7  $self->{config} = $params->{config};
8  bless $self;
9}
10
11sub addMsg {
12
13  my ($self, $args) = @_;
14
15  my $level = $args->{level};
16  my $message = $args->{message};
17
18  return if $message =~ /^$/;
19 
20  # if STDERR has been hijacked, I take its saved ref
21  my $stderr;
22  if (exists ($self->{config}->{savedstderr})) {
23    $stderr = $self->{config}->{savedstderr};
24  } else {
25    open ($stderr, ">&STDERR");
26  }
27
28
29  print $stderr "[$level] $message\n";
30
31}
32
331;
Note: See TracBrowser for help on using the repository browser.