mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-12 09:33:37 +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:
@@ -19,6 +19,7 @@
|
||||
//
|
||||
|
||||
#include <stdio.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include <rdapplication.h>
|
||||
#include <rddb.h>
|
||||
@@ -60,8 +61,7 @@ void MainObject::rmlReceivedData(RDMacro *rml)
|
||||
}
|
||||
if(rml->argQuantity()==1) { // Clear Log
|
||||
air_logs[index]->clear();
|
||||
rda->log(RDConfig::LogInfo,QString().sprintf("unloaded log machine %d",
|
||||
rml->arg(0).toInt()));
|
||||
syslog(LOG_INFO,"unloaded log machine %d",rml->arg(0).toInt());
|
||||
}
|
||||
else { // Load Log
|
||||
logname=rml->arg(1);
|
||||
@@ -74,21 +74,20 @@ void MainObject::rmlReceivedData(RDMacro *rml)
|
||||
}
|
||||
air_logs[index]->setLogName(logname);
|
||||
air_logs[index]->load();
|
||||
rda->log(RDConfig::LogInfo,"loaded log \""+logname+"\" into log machine"+
|
||||
QString().sprintf(" %d",rml->arg(0).toInt()));
|
||||
syslog(LOG_INFO,"loaded log \"%s\" into log machine %d",
|
||||
(const char *)logname.toUtf8(),
|
||||
rml->arg(0).toInt());
|
||||
}
|
||||
if(rml->argQuantity()==3) { // Start Log
|
||||
if(rml->arg(2).toInt()<air_logs[index]->size()) {
|
||||
if(rml->arg(2).toInt()>=0) { // Unconditional start
|
||||
if(air_logs[index]->play(rml->arg(2).toInt(),RDLogLine::StartMacro)) {
|
||||
rda->log(RDConfig::LogInfo,QString().
|
||||
sprintf("started log machine %d at line %d",
|
||||
rml->arg(0).toInt(),rml->arg(2).toInt()));
|
||||
syslog(LOG_INFO,"started log machine %d at line %d",
|
||||
rml->arg(0).toInt(),rml->arg(2).toInt());
|
||||
}
|
||||
else {
|
||||
rda->log(RDConfig::LogWarning,QString().
|
||||
sprintf("1 log machine %d failed to start",
|
||||
rml->arg(0).toInt()));
|
||||
syslog(LOG_WARNING,"log machine %d failed to start",
|
||||
rml->arg(0).toInt());
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(false);
|
||||
rda->ripc()->sendRml(rml);
|
||||
@@ -112,14 +111,12 @@ void MainObject::rmlReceivedData(RDMacro *rml)
|
||||
case RDLogLine::Play:
|
||||
case RDLogLine::Segue:
|
||||
if(air_logs[index]->play(0,RDLogLine::StartMacro)) {
|
||||
rda->log(RDConfig::LogInfo,QString().
|
||||
sprintf("started log machine %d at line 0",
|
||||
rml->arg(0).toInt()));
|
||||
syslog(LOG_INFO,"started log machine %d at line 0",
|
||||
rml->arg(0).toInt());
|
||||
}
|
||||
else {
|
||||
rda->log(RDConfig::LogWarning,QString().
|
||||
sprintf("2 log machine %d failed to start",
|
||||
rml->arg(0).toInt()));
|
||||
syslog(LOG_WARNING,"log machine %d failed to start",
|
||||
rml->arg(0).toInt());
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(false);
|
||||
rda->ripc()->sendRml(rml);
|
||||
@@ -166,8 +163,8 @@ void MainObject::rmlReceivedData(RDMacro *rml)
|
||||
return;
|
||||
}
|
||||
air_logs[index]->append(logname);
|
||||
rda->log(RDConfig::LogInfo,QString("appended log \"")+logname+
|
||||
QString().sprintf("\" into log machine %d",rml->arg(0).toInt()));
|
||||
syslog(LOG_INFO,"appended log \"%s\" into log machine %d",
|
||||
(const char *)logname.toUtf8(),rml->arg(0).toInt());
|
||||
break;
|
||||
|
||||
case RDMacro::MN: // Make Next
|
||||
@@ -194,9 +191,8 @@ void MainObject::rmlReceivedData(RDMacro *rml)
|
||||
return;
|
||||
}
|
||||
air_logs[index]->makeNext(rml->arg(1).toInt());
|
||||
rda->log(RDConfig::LogInfo,
|
||||
QString().sprintf("made line %d next in log machine %d",
|
||||
rml->arg(1).toInt(),rml->arg(0).toInt()));
|
||||
syslog(LOG_INFO,"made line %d next in log machine %d",
|
||||
rml->arg(1).toInt(),rml->arg(0).toInt());
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(true);
|
||||
rda->ripc()->sendRml(rml);
|
||||
@@ -228,14 +224,12 @@ void MainObject::rmlReceivedData(RDMacro *rml)
|
||||
}
|
||||
if(!air_logs[index]->running()) {
|
||||
if(air_logs[index]->play(rml->arg(1).toInt(),RDLogLine::StartMacro)) {
|
||||
rda->log(RDConfig::LogInfo,QString().
|
||||
sprintf("started log machine %d at line %d",
|
||||
rml->arg(0).toInt(),rml->arg(2).toInt()));
|
||||
syslog(LOG_INFO,"started log machine %d at line %d",
|
||||
rml->arg(0).toInt(),rml->arg(2).toInt());
|
||||
}
|
||||
else {
|
||||
rda->log(RDConfig::LogWarning,QString().
|
||||
sprintf("3 log machine %d failed to start",
|
||||
rml->arg(0).toInt()));
|
||||
syslog(LOG_WARNING,"log machine %d failed to start",
|
||||
rml->arg(0).toInt());
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(false);
|
||||
rda->ripc()->sendRml(rml);
|
||||
@@ -243,9 +237,8 @@ void MainObject::rmlReceivedData(RDMacro *rml)
|
||||
return;
|
||||
}
|
||||
}
|
||||
rda->log(RDConfig::LogInfo,QString().
|
||||
sprintf("started log machine %d at line %d",
|
||||
rml->arg(0).toInt(),rml->arg(1).toInt()));
|
||||
syslog(LOG_INFO,"started log machine %d at line %d",
|
||||
rml->arg(0).toInt(),rml->arg(1).toInt());
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(true);
|
||||
rda->ripc()->sendRml(rml);
|
||||
@@ -345,9 +338,8 @@ void MainObject::rmlReceivedData(RDMacro *rml)
|
||||
if(rml->argQuantity()==1) {
|
||||
if(!air_logs[index]->
|
||||
play(air_logs[index]->nextLine(),RDLogLine::StartMacro)) {
|
||||
rda->log(RDConfig::LogWarning,QString().
|
||||
sprintf("4 log machine %d failed to start",
|
||||
rml->arg(0).toInt()));
|
||||
syslog(LOG_WARNING,"log machine %d failed to start",
|
||||
rml->arg(0).toInt());
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(false);
|
||||
rda->ripc()->sendRml(rml);
|
||||
@@ -360,9 +352,8 @@ void MainObject::rmlReceivedData(RDMacro *rml)
|
||||
if(!air_logs[index]->play(air_logs[index]->nextLine(),
|
||||
RDLogLine::StartMacro,
|
||||
rml->arg(1).toInt()-1)) {
|
||||
rda->log(RDConfig::LogWarning,QString().
|
||||
sprintf("5 log machine %d failed to start",
|
||||
rml->arg(0).toInt()));
|
||||
syslog(LOG_WARNING,"log machine %d failed to start",
|
||||
rml->arg(0).toInt());
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(false);
|
||||
rda->ripc()->sendRml(rml);
|
||||
@@ -374,9 +365,8 @@ void MainObject::rmlReceivedData(RDMacro *rml)
|
||||
if(!air_logs[index]->
|
||||
play(air_logs[index]->nextLine(),RDLogLine::StartMacro,
|
||||
rml->arg(1).toInt()-1,rml->arg(2).toInt())) {
|
||||
rda->log(RDConfig::LogWarning,QString().
|
||||
sprintf("6 log machine %d failed to start",
|
||||
rml->arg(0).toInt()));
|
||||
syslog(LOG_WARNING,"log machine %d failed to start",
|
||||
rml->arg(0).toInt());
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(false);
|
||||
rda->ripc()->sendRml(rml);
|
||||
@@ -385,9 +375,8 @@ void MainObject::rmlReceivedData(RDMacro *rml)
|
||||
}
|
||||
}
|
||||
}
|
||||
rda->log(RDConfig::LogInfo,QString().
|
||||
sprintf("started log machine %d at line %d",
|
||||
rml->arg(0).toInt(),next_line));
|
||||
syslog(LOG_INFO,"started log machine %d at line %d",
|
||||
rml->arg(0).toInt(),next_line);
|
||||
}
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(true);
|
||||
@@ -419,7 +408,7 @@ void MainObject::rmlReceivedData(RDMacro *rml)
|
||||
for(int i=0;i<RD_RDVAIRPLAY_LOG_QUAN;i++) {
|
||||
air_logs[i]->stop(true,0,fade);
|
||||
}
|
||||
rda->log(RDConfig::LogInfo,"stopped all logs");
|
||||
syslog(LOG_INFO,"stopped all logs");
|
||||
}
|
||||
else {
|
||||
if(rml->argQuantity()==3) {
|
||||
@@ -428,8 +417,7 @@ void MainObject::rmlReceivedData(RDMacro *rml)
|
||||
else {
|
||||
air_logs[index]->stop(true,0,fade);
|
||||
}
|
||||
rda->log(RDConfig::LogInfo,QString().sprintf("stopped log machine %d",
|
||||
rml->arg(0).toInt()));
|
||||
syslog(LOG_INFO,"stopped log machine %d",rml->arg(0).toInt());
|
||||
break;
|
||||
}
|
||||
if(rml->echoRequested()) {
|
||||
@@ -458,9 +446,8 @@ void MainObject::rmlReceivedData(RDMacro *rml)
|
||||
for(int i=0;i<RD_RDVAIRPLAY_LOG_QUAN;i++) {
|
||||
air_logs[i]->duckVolume(rml->arg(1).toInt()*100,rml->arg(2).toInt());
|
||||
}
|
||||
rda->log(RDConfig::LogInfo,QString().
|
||||
sprintf("set volumne of all log machines to %d dBFS",
|
||||
rml->arg(1).toInt()));
|
||||
syslog(LOG_INFO,"set volumne of all log machines to %d dBFS",
|
||||
rml->arg(1).toInt());
|
||||
}
|
||||
else {
|
||||
if(rml->argQuantity()==3) {
|
||||
@@ -471,10 +458,9 @@ void MainObject::rmlReceivedData(RDMacro *rml)
|
||||
air_logs[index]->duckVolume(rml->arg(1).toInt()*100,
|
||||
rml->arg(2).toInt(),rml->arg(3).toInt());
|
||||
}
|
||||
rda->log(RDConfig::LogInfo,QString().
|
||||
sprintf("set volumne of log machine %d to %d dBFS",
|
||||
rml->arg(0).toInt(),
|
||||
rml->arg(1).toInt()));
|
||||
syslog(LOG_INFO,"set volumne of log machine %d to %d dBFS",
|
||||
rml->arg(0).toInt(),
|
||||
rml->arg(1).toInt());
|
||||
break;
|
||||
}
|
||||
if(rml->echoRequested()) {
|
||||
@@ -503,18 +489,16 @@ void MainObject::rmlReceivedData(RDMacro *rml)
|
||||
if(air_logs[index]->nextLine()>=0) {
|
||||
air_logs[index]->insert(air_logs[index]->nextLine(),
|
||||
rml->arg(1).toUInt(),RDLogLine::Play);
|
||||
rda->log(RDConfig::LogInfo,QString().
|
||||
sprintf("inserted cart %06u at line %d on log machine %d",
|
||||
rml->arg(1).toUInt(),next_line,rml->arg(0).toInt()));
|
||||
syslog(LOG_INFO,"inserted cart %06u at line %d on log machine %d",
|
||||
rml->arg(1).toUInt(),next_line,rml->arg(0).toInt());
|
||||
}
|
||||
else {
|
||||
air_logs[index]->insert(air_logs[index]->size(),
|
||||
rml->arg(1).toUInt(),RDLogLine::Play);
|
||||
air_logs[index]->makeNext(air_logs[index]->size()-1);
|
||||
rda->log(RDConfig::LogInfo,QString().
|
||||
sprintf("inserted cart %06u at line %d on log machine %d",
|
||||
rml->arg(1).toUInt(),air_logs[index]->size()-1,
|
||||
rml->arg(0).toInt()));
|
||||
syslog(LOG_INFO,"inserted cart %06u at line %d on log machine %d",
|
||||
rml->arg(1).toUInt(),air_logs[index]->size()-1,
|
||||
rml->arg(0).toInt());
|
||||
}
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(true);
|
||||
@@ -545,8 +529,7 @@ void MainObject::rmlReceivedData(RDMacro *rml)
|
||||
return;
|
||||
}
|
||||
else {
|
||||
rda->log(RDConfig::LogInfo,QString().sprintf("refreshed log machine %d",
|
||||
rml->arg(0).toInt()));
|
||||
syslog(LOG_INFO,"refreshed log machine %d",rml->arg(0).toInt());
|
||||
}
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(true);
|
||||
@@ -586,15 +569,13 @@ void MainObject::rmlReceivedData(RDMacro *rml)
|
||||
}
|
||||
if(rml->arg(0).lower()=="now") {
|
||||
air_logs[index]->setNowCart(rml->arg(2).toUInt());
|
||||
rda->log(RDConfig::LogInfo,QString().
|
||||
sprintf("set default \"now\" cart to %06u on log machine %d",
|
||||
rml->arg(2).toUInt(),rml->arg(1).toInt()));
|
||||
syslog(LOG_INFO,"set default \"now\" cart to %06u on log machine %d",
|
||||
rml->arg(2).toUInt(),rml->arg(1).toInt());
|
||||
}
|
||||
else {
|
||||
air_logs[index]->setNextCart(rml->arg(2).toUInt());
|
||||
rda->log(RDConfig::LogInfo,QString().
|
||||
sprintf("set default \"next\" cart to %06u on log machine %d",
|
||||
rml->arg(2).toUInt(),rml->arg(1).toInt()));
|
||||
syslog(LOG_INFO,"set default \"next\" cart to %06u on log machine %d",
|
||||
rml->arg(2).toUInt(),rml->arg(1).toInt());
|
||||
}
|
||||
if(rml->echoRequested()) {
|
||||
rml->acknowledge(true);
|
||||
|
@@ -22,6 +22,7 @@
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <qapplication.h>
|
||||
@@ -237,8 +238,8 @@ void MainObject::ripcConnectedData(bool state)
|
||||
rda->ripc()->sendRml(&rml);
|
||||
}
|
||||
else {
|
||||
rda->log(RDConfig::LogWarning,QString().sprintf("vlog %d: ",mach+1)+
|
||||
"log \""+air_start_lognames[i]+"\" doesn't exist");
|
||||
syslog(LOG_WARNING,"vlog %d: log \"%s\" doesn't exist",mach+1,
|
||||
(const char *)air_start_lognames[i].toUtf8());
|
||||
}
|
||||
delete q;
|
||||
}
|
||||
@@ -286,9 +287,9 @@ void MainObject::logReloadedData(int log)
|
||||
}
|
||||
}
|
||||
else {
|
||||
rda->log(RDConfig::LogWarning,QString().sprintf("vlog %d: ",mach+1)+
|
||||
QString().sprintf("line %d doesn't exist ",air_start_lines[log])+
|
||||
"in log \""+air_start_lognames[log]+"\"");
|
||||
syslog(LOG_WARNING,"vlog %d: line %d doesn't exist in log \"%s\"",mach+1,
|
||||
air_start_lines[log],
|
||||
(const char *)air_start_lognames[log].toUtf8());
|
||||
}
|
||||
air_start_lognames[log]="";
|
||||
}
|
||||
@@ -301,7 +302,7 @@ void MainObject::exitData()
|
||||
delete air_logs[i];
|
||||
}
|
||||
rda->airplayConf()->setVirtualExitCode(RDAirPlayConf::ExitClean);
|
||||
rda->log(RDConfig::LogInfo,"exiting");
|
||||
syslog(LOG_INFO,"exiting");
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
@@ -310,27 +311,24 @@ void MainObject::exitData()
|
||||
void MainObject::SetAutoMode(int index)
|
||||
{
|
||||
air_logs[index]->setOpMode(RDAirPlayConf::Auto);
|
||||
rda->log(RDConfig::LogInfo,
|
||||
QString().sprintf("log machine %d mode set to AUTOMATIC",
|
||||
index+RD_RDVAIRPLAY_LOG_BASE+1));
|
||||
syslog(LOG_INFO,"log machine %d mode set to AUTOMATIC",
|
||||
index+RD_RDVAIRPLAY_LOG_BASE+1);
|
||||
}
|
||||
|
||||
|
||||
void MainObject::SetLiveAssistMode(int index)
|
||||
{
|
||||
air_logs[index]->setOpMode(RDAirPlayConf::LiveAssist);
|
||||
rda->log(RDConfig::LogInfo,
|
||||
QString().sprintf("log machine %d mode set to LIVE ASSIST",
|
||||
index+RD_RDVAIRPLAY_LOG_BASE+1));
|
||||
syslog(LOG_INFO,"log machine %d mode set to LIVE ASSIST",
|
||||
index+RD_RDVAIRPLAY_LOG_BASE+1);
|
||||
}
|
||||
|
||||
|
||||
void MainObject::SetManualMode(int index)
|
||||
{
|
||||
air_logs[index]->setOpMode(RDAirPlayConf::Manual);
|
||||
rda->log(RDConfig::LogInfo,
|
||||
QString().sprintf("log machine %d mode set to MANUAL",
|
||||
index+RD_RDVAIRPLAY_LOG_BASE+1));
|
||||
syslog(LOG_INFO,"log machine %d mode set to MANUAL",
|
||||
index+RD_RDVAIRPLAY_LOG_BASE+1);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user