mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-10 16:43:35 +02:00
2019-06-17 Fred Gleason <fredg@paravelsystems.com>
* Refactored logging system to use syslog(3) exclusively. * Removed the 'Facility=', 'LogDirectory=', 'CoreDumpDirectory=' and 'LogPattern=' directives from rd.conf(5).
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// Replicator implementation for the Citadel XDS Portal
|
||||
//
|
||||
// (C) Copyright 2010-2018 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2010-2019 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <syslog.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <qfileinfo.h>
|
||||
@@ -100,9 +101,8 @@ void CitadelXds::CheckIsciXreference()
|
||||
}
|
||||
}
|
||||
else {
|
||||
rda->config()->log("rdrepld",RDConfig::LogErr,
|
||||
QString().sprintf("unable to load ISCI cross reference file \"%s\"",
|
||||
(const char *)rda->system()->isciXreferencePath()));
|
||||
syslog(LOG_WARNING,"unable to load ISCI cross reference file \"%s\"",
|
||||
(const char *)rda->system()->isciXreferencePath().toUtf8());
|
||||
}
|
||||
delete fi;
|
||||
}
|
||||
@@ -122,10 +122,9 @@ bool CitadelXds::LoadIsciXreference(const QString &filename)
|
||||
unsigned linenum=3;
|
||||
|
||||
if((f=fopen(filename,"r"))==NULL) {
|
||||
rda->config()->log("rdrepld",RDConfig::LogErr,
|
||||
QString().sprintf("unable to load ISCI cross reference file \"%s\" [%s]",
|
||||
(const char *)rda->system()->isciXreferencePath(),
|
||||
strerror(errno)));
|
||||
syslog(LOG_WARNING,"unable to load ISCI cross reference file \"%s\" [%s]",
|
||||
(const char *)rda->system()->isciXreferencePath().toUtf8(),
|
||||
strerror(errno));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -173,33 +172,30 @@ bool CitadelXds::LoadIsciXreference(const QString &filename)
|
||||
delete q;
|
||||
}
|
||||
else {
|
||||
rda->config()->log("rdrepld",RDConfig::LogWarning,QString().
|
||||
sprintf("invalid date in line %d of \"%s\"",
|
||||
linenum,(const char *)filename));
|
||||
syslog(LOG_WARNING,"invalid date in line %d of \"%s\"",
|
||||
linenum,(const char *)filename.toUtf8());
|
||||
}
|
||||
}
|
||||
else {
|
||||
rda->config()->log("rdrepld",RDConfig::LogWarning,QString().
|
||||
sprintf("invalid FILENAME field \"%s\" in line %d of \"%s\"",
|
||||
(const char *)fields[8],linenum,(const char *)filename));
|
||||
syslog(LOG_WARNING,
|
||||
"invalid FILENAME field \"%s\" in line %d of \"%s\"",
|
||||
(const char *)fields[8].toUtf8(),linenum,
|
||||
(const char *)filename.toUtf8());
|
||||
}
|
||||
}
|
||||
else {
|
||||
rda->config()->log("rdrepld",RDConfig::LogWarning,QString().
|
||||
sprintf("invalid date in line %d of \"%s\"",
|
||||
linenum,(const char *)filename));
|
||||
syslog(LOG_WARNING,"invalid date in line %d of \"%s\"",
|
||||
linenum,(const char *)filename.toUtf8());
|
||||
}
|
||||
}
|
||||
else {
|
||||
rda->config()->log("rdrepld",RDConfig::LogDebug,QString().
|
||||
sprintf("missing/invalid cart number in line %d of \"%s\"",
|
||||
linenum,(const char *)filename));
|
||||
syslog(LOG_DEBUG,"missing/invalid cart number in line %d of \"%s\"",
|
||||
linenum,(const char *)filename.toUtf8());
|
||||
}
|
||||
}
|
||||
else {
|
||||
rda->config()->log("rdrepld",RDConfig::LogWarning,QString().
|
||||
sprintf("line %d malformed in \"%s\"",
|
||||
linenum,(const char *)filename));
|
||||
syslog(LOG_WARNING,"line %d malformed in \"%s\"",
|
||||
linenum,(const char *)filename.toUtf8());
|
||||
}
|
||||
linenum++;
|
||||
}
|
||||
@@ -207,9 +203,8 @@ bool CitadelXds::LoadIsciXreference(const QString &filename)
|
||||
//
|
||||
// Clean Up
|
||||
//
|
||||
rda->config()->log("rdrepld",RDConfig::LogInfo,
|
||||
QString().sprintf("loaded ISCI cross reference file \"%s\"",
|
||||
(const char *)rda->system()->isciXreferencePath()));
|
||||
syslog(LOG_INFO,"loaded ISCI cross reference file \"%s\"",
|
||||
(const char *)rda->system()->isciXreferencePath().toUtf8());
|
||||
fclose(f);
|
||||
return true;
|
||||
}
|
||||
@@ -353,10 +348,9 @@ bool CitadelXds::PostCut(const QString &cutname,const QString &filename)
|
||||
break;
|
||||
|
||||
default:
|
||||
rda->config()->log("rdrepld",RDConfig::LogErr,
|
||||
QString().sprintf("CitadelXds: audio conversion failed: %s, cutname: %s",
|
||||
(const char *)RDAudioConvert::errorText(conv_err),
|
||||
(const char *)cutname));
|
||||
syslog(LOG_WARNING,"CitadelXds: audio conversion failed: %s, cutname: %s",
|
||||
(const char *)RDAudioConvert::errorText(conv_err).toUtf8(),
|
||||
(const char *)cutname.toUtf8());
|
||||
delete conv;
|
||||
delete settings;
|
||||
return false;
|
||||
@@ -377,20 +371,18 @@ bool CitadelXds::PostCut(const QString &cutname,const QString &filename)
|
||||
break;
|
||||
|
||||
default:
|
||||
rda->config()->log("rdrepld",RDConfig::LogErr,
|
||||
QString().sprintf("CitadelXds: audio upload failed: %s",
|
||||
(const char *)RDUpload::errorText(upload_err)));
|
||||
syslog(LOG_WARNING,"CitadelXds: audio upload failed: %s",
|
||||
(const char *)RDUpload::errorText(upload_err).toUtf8());
|
||||
unlink(tempfile);
|
||||
delete upload;
|
||||
return false;
|
||||
}
|
||||
unlink(tempfile);
|
||||
delete upload;
|
||||
rda->config()->log("rdrepld",RDConfig::LogInfo,
|
||||
QString().sprintf("CitadelXds: uploaded cut %s to %s/%s",
|
||||
(const char *)cutname,
|
||||
(const char *)config()->url(),
|
||||
(const char *)filename));
|
||||
syslog(LOG_INFO,"CitadelXds: uploaded cut %s to %s/%s",
|
||||
(const char *)cutname.toUtf8(),
|
||||
(const char *)config()->url().toUtf8(),
|
||||
(const char *)filename.toUtf8());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -431,17 +423,15 @@ void CitadelXds::PurgeCuts()
|
||||
q->value(0).toInt());
|
||||
q2=new RDSqlQuery(sql);
|
||||
delete q2;
|
||||
rda->config()->log("rdrepld",RDConfig::LogInfo,
|
||||
QString().sprintf("purged \"%s\" for replicator \"%s\"",
|
||||
(const char *)url.toString(),
|
||||
(const char *)config()->name()));
|
||||
syslog(LOG_INFO,"purged \"%s\" for replicator \"%s\"",
|
||||
(const char *)url.toString().toUtf8(),
|
||||
(const char *)config()->name().toUtf8());
|
||||
}
|
||||
else {
|
||||
rda->config()->log("rdrepld",RDConfig::LogErr,
|
||||
QString().sprintf("unable to delete \"%s\" for replicator \"%s\" [%s]",
|
||||
(const char *)url.toString(),
|
||||
(const char *)config()->name(),
|
||||
(const char *)RDDelete::errorText(conv_err)));
|
||||
syslog(LOG_WARNING,"unable to delete \"%s\" for replicator \"%s\" [%s]",
|
||||
(const char *)url.toString().toUtf8(),
|
||||
(const char *)config()->name().toUtf8(),
|
||||
(const char *)RDDelete::errorText(conv_err).toUtf8());
|
||||
}
|
||||
delete conv;
|
||||
}
|
||||
|
@@ -19,6 +19,7 @@
|
||||
//
|
||||
|
||||
#include <signal.h>
|
||||
#include <syslog.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
@@ -118,7 +119,7 @@ MainObject::MainObject(QObject *parent)
|
||||
connect(repl_loop_timer,SIGNAL(timeout()),this,SLOT(mainLoop()));
|
||||
repl_loop_timer->start(RD_RDREPL_SCAN_INTERVAL,true);
|
||||
|
||||
rda->config()->log("rdrepld",RDConfig::LogNotice,"started");
|
||||
syslog(LOG_INFO,"started");
|
||||
}
|
||||
|
||||
|
||||
@@ -131,12 +132,6 @@ void MainObject::mainLoop()
|
||||
}
|
||||
|
||||
|
||||
void MainObject::log(RDConfig::LogPriority prio,const QString &msg)
|
||||
{
|
||||
rda->config()->log("rdrepld",prio,msg);
|
||||
}
|
||||
|
||||
|
||||
void MainObject::ProcessCarts()
|
||||
{
|
||||
QString sql;
|
||||
|
@@ -42,7 +42,6 @@ class MainObject : public QObject
|
||||
|
||||
private slots:
|
||||
void mainLoop();
|
||||
void log(RDConfig::LogPriority prio,const QString &line);
|
||||
|
||||
private:
|
||||
void ProcessCarts();
|
||||
|
Reference in New Issue
Block a user