# List of all package maintainers
my $maintainers_bypkg = "/home/gatekpr/etc/maintainers.bypkg";
-{
- our $Log_Style = 'GNU';
- $Log_Style = 'Alpha' if ($style eq 'alpha');
- $Log_Style = 'Distros' if ($style eq 'distros');
-}
-
# maintainer e-mail address
my $maintainer_email = "ftp-upload-report\@gnu.org";
# verify configuration for mock syslog
die "gatekeeper: test mode: TEST_SYSLOG_SOCKET not valid"
unless $ENV{TEST_SYSLOG_SOCKET} && -S $ENV{TEST_SYSLOG_SOCKET} && -w _;
- # override log message tag
- our $Log_Style = 'Test';
} else { # in production mode
# ensure we are using the real gpgv
open my $gpgv,'-|',GPGV_BIN, '--version'
# - Logging
#
+{
+ # To identify which zone is being processed, ftp_syslog will prepend
+ # this, inside parentheses, to all messages logged.
+ if (IN_TEST_MODE) {
+ # override log message tag
+ our $Log_Style = 'Test';
+ } else {
+ our $Log_Style = 'GNU';
+ $Log_Style = 'Alpha' if ($style eq 'alpha');
+ $Log_Style = 'Distros' if ($style eq 'distros');
+ }
+
+ # If this is set to a defined value, ftp_syslog will prepend it, inside
+ # square brackets, to all messages logged.
+ our $Phase = undef; # should be set using local
+
+ # If this is set to a defined value, ftp_abort will write the message
+ # here instead of using syslog.
+ our $AbortPipe = undef;
+ # This selects the default exit code, if no code is specified.
+ our $AbortExitCode = 1;
+}
+
sub ftp_syslog {
my $priority = shift;
my $message = shift;
- our $Log_Style;
+ our $Log_Style; our $Phase;
# Remove a trailing newline
$message =~ s/[\r\n]+$//;
# Collapse the message to a single line for syslog
$message =~ s/[\r\n]+/ \/ /g;
+ # Prepend the current phase, if set
+ $message = '['.$Phase.'] '.$message if defined $Phase;
+
# Prepend the log style tag
- $message = "($Log_Style) ".$message;
+ $message = '('.$Log_Style.') '.$message;
# The syslog function is pretty picky, and (sometimes) dies silently
# when using non-valid syslog priorities.
cluck($@) if $@;
}
-{
- # If this is set to a defined value, ftp_abort will write the message
- # here instead of using syslog.
- our $AbortPipe = undef;
- # This selects the default exit code, if no code is specified.
- our $AbortExitCode = 1;
-}
-
sub ftp_abort($;$) {
my $msg = shift;
my $exitcode = shift;