mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
Merge branch '3366-mensajes-ejecutar-pandora_db' into 'develop'
Added a string with information of the caller of pandora_server. Modified too... See merge request artica/pandorafms!2786
This commit is contained in:
commit
1cbeed7b06
@ -641,19 +641,26 @@ sub logger ($$;$) {
|
|||||||
# Set the security level
|
# Set the security level
|
||||||
my $security_level = 'info';
|
my $security_level = 'info';
|
||||||
if ($level < 2) {
|
if ($level < 2) {
|
||||||
$security = 'crit';
|
$security_level = 'crit';
|
||||||
} elsif ($level < 5) {
|
} elsif ($level < 5) {
|
||||||
$security = 'warn';
|
$security_level = 'warn';
|
||||||
}
|
}
|
||||||
|
|
||||||
openlog('pandora_server', 'ndelay', 'daemon');
|
openlog('pandora_server', 'ndelay', 'daemon');
|
||||||
syslog($security_level, $message);
|
syslog($security_level, $message);
|
||||||
closelog();
|
closelog();
|
||||||
} else {
|
} else {
|
||||||
|
# Obtain the script that invoke this log
|
||||||
|
my $parent_caller = "";
|
||||||
|
if (($parent_caller = ( caller(2) )[1]) ne "") {
|
||||||
|
$parent_caller = (split '/', $parent_caller)[-1];
|
||||||
|
$parent_caller =~ s/\.[^.]+$//;
|
||||||
|
$parent_caller = " ** " . $parent_caller . " **:";
|
||||||
|
}
|
||||||
open (FILE, ">> $file") or die "[FATAL] Could not open logfile '$file'";
|
open (FILE, ">> $file") or die "[FATAL] Could not open logfile '$file'";
|
||||||
# Get an exclusive lock on the file (LOCK_EX)
|
# Get an exclusive lock on the file (LOCK_EX)
|
||||||
flock (FILE, 2);
|
flock (FILE, 2);
|
||||||
print FILE strftime ("%Y-%m-%d %H:%M:%S", localtime()) . " " . (defined($pa_config->{'servername'}) ? $pa_config->{'servername'} : '') . " [V". $level ."] " . $message . "\n";
|
print FILE strftime ("%Y-%m-%d %H:%M:%S", localtime()) . $parent_caller . " " . (defined($pa_config->{'servername'}) ? $pa_config->{'servername'} : '') . " [V". $level ."] " . $message . "\n";
|
||||||
close (FILE);
|
close (FILE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user