aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2014-01-12 21:54:07 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-01-12 21:54:07 +0100
commitf1874c259259a039227517a9cd58d7017a1bef34 (patch)
treefb1cc85521a67d5efb05434fe78cb43a4098e03d
parente9c4e1762c3b7531ffe82dc26c67919ee38bfc3a (diff)
downloaddabmux-f1874c259259a039227517a9cd58d7017a1bef34.tar.gz
dabmux-f1874c259259a039227517a9cd58d7017a1bef34.tar.bz2
dabmux-f1874c259259a039227517a9cd58d7017a1bef34.zip
replace all occurrencies of TcpLog and old etiLog
-rw-r--r--doc/example.mux4
-rw-r--r--src/DabMux.cpp110
-rw-r--r--src/Log.h2
-rw-r--r--src/MuxElements.cpp12
-rw-r--r--src/ParserCmdline.cpp96
-rw-r--r--src/ParserConfigfile.cpp22
-rw-r--r--src/dabInput.cpp3
-rw-r--r--src/dabInputBridgeUdp.cpp6
-rw-r--r--src/dabInputDabplusFifo.cpp2
-rw-r--r--src/dabInputDabplusFile.cpp12
-rw-r--r--src/dabInputDmbFile.cpp8
-rw-r--r--src/dabInputDmbUdp.cpp20
-rw-r--r--src/dabInputFifo.cpp24
-rw-r--r--src/dabInputMpegFile.cpp30
-rw-r--r--src/dabInputPacketFile.cpp14
-rw-r--r--src/dabInputPrbs.cpp6
-rw-r--r--src/dabInputRawFifo.cpp10
-rw-r--r--src/dabInputRawFile.cpp2
-rw-r--r--src/dabInputSlip.cpp30
-rw-r--r--src/dabInputUdp.cpp20
-rw-r--r--src/dabInputZmq.cpp20
-rw-r--r--src/dabOutput/dabOutput.cpp6
-rw-r--r--src/dabOutput/dabOutputFifo.cpp2
-rw-r--r--src/dabOutput/dabOutputFile.cpp6
-rw-r--r--src/dabOutput/dabOutputRaw.cpp60
-rw-r--r--src/dabOutput/dabOutputTcp.cpp18
-rw-r--r--src/dabOutput/dabOutputUdp.cpp10
-rw-r--r--src/utils.cpp154
28 files changed, 355 insertions, 354 deletions
diff --git a/doc/example.mux b/doc/example.mux
index 868211d..ac6842e 100644
--- a/doc/example.mux
+++ b/doc/example.mux
@@ -23,8 +23,8 @@ general {
; boolean fileds can accept either false or true as values:
- ; Enable TCPLog on port 12222
- tcplog false
+ ; Enable logging to syslog
+ syslog false
; Write the SCCA field useful for the Factum ETI analyser
writescca false
diff --git a/src/DabMux.cpp b/src/DabMux.cpp
index 5e0fb6c..bd8e685 100644
--- a/src/DabMux.cpp
+++ b/src/DabMux.cpp
@@ -168,34 +168,34 @@ bool running = true;
void signalHandler(int signum)
{
#ifdef _WIN32
- etiLog.print(TcpLog::DBG, "\npid: %i\n", _getpid());
+ etiLog.log(debug, "\npid: %i\n", _getpid());
#else
- etiLog.print(TcpLog::DBG, "\npid: %i, ppid: %i\n", getpid(), getppid());
+ etiLog.log(debug, "\npid: %i, ppid: %i\n", getpid(), getppid());
#endif
- etiLog.print(TcpLog::DBG, "Signal handler called with signal ");
+ etiLog.log(debug, "Signal handler called with signal ");
switch (signum) {
#ifndef _WIN32
case SIGHUP:
- etiLog.print(TcpLog::DBG, "SIGHUP\n");
+ etiLog.log(debug, "SIGHUP\n");
break;
case SIGQUIT:
- etiLog.print(TcpLog::DBG, "SIGQUIT\n");
+ etiLog.log(debug, "SIGQUIT\n");
break;
case SIGPIPE:
- etiLog.print(TcpLog::DBG, "SIGPIPE\n");
+ etiLog.log(debug, "SIGPIPE\n");
return;
break;
#endif
case SIGINT:
- etiLog.print(TcpLog::DBG, "SIGINT\n");
+ etiLog.log(debug, "SIGINT\n");
break;
case SIGTERM:
- etiLog.print(TcpLog::DBG, "SIGTERM\n");
- etiLog.print(TcpLog::DBG, "Exiting software\n");
+ etiLog.log(debug, "SIGTERM\n");
+ etiLog.log(debug, "Exiting software\n");
exit(0);
break;
default:
- etiLog.print(TcpLog::DBG, "number %i\n", signum);
+ etiLog.log(debug, "number %i\n", signum);
}
#ifndef _WIN32
killpg(0, SIGPIPE);
@@ -222,19 +222,19 @@ int main(int argc, char *argv[])
#ifdef _WIN32
if (SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST) == 0) {
- etiLog.printHeader(TcpLog::WARNING, "Can't increase priority: %s\n",
+ etiLog.log(warn, "Can't increase priority: %s\n",
strerror(errno));
}
#else
if (setpriority(PRIO_PROCESS, 0, -20) == -1) {
- etiLog.printHeader(TcpLog::WARNING, "Can't increase priority: %s\n",
+ etiLog.log(warn, "Can't increase priority: %s\n",
strerror(errno));
}
#endif
/*sched_param scheduler;
scheduler.sched_priority = 99; // sched_get_priority_max(SCHED_RR)
if (sched_setscheduler(0, SCHED_RR, &scheduler) == -1) {
- etiLog.print(TcpLog::WARNING, "Can't increased priority: %s\n",
+ etiLog.log(warn, "Can't increased priority: %s\n",
strerror(errno));
}*/
@@ -346,7 +346,7 @@ int main(int argc, char *argv[])
}
catch (runtime_error &e) {
- etiLog.printHeader(TcpLog::ERR, "Configuration file parsing error: %s\n",
+ etiLog.log(error, "Configuration file parsing error: %s\n",
e.what());
goto EXIT;
}
@@ -361,7 +361,7 @@ int main(int argc, char *argv[])
if (outputs.size() == 0) {
- etiLog.printHeader(TcpLog::WARNING, "no output defined\n");
+ etiLog.log(warn, "no output defined\n");
// initialise a new dabOutput
outputs.push_back(new dabOutput("simul", NULL));
@@ -378,7 +378,7 @@ int main(int argc, char *argv[])
subchannel != ensemble->subchannels.end();
++subchannel) {
if (ids.find((*subchannel)->id) != ids.end()) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Subchannel %u is set more than once!\n",
(*subchannel)->id);
returnCode = -1;
@@ -394,7 +394,7 @@ int main(int argc, char *argv[])
service != ensemble->services.end();
++service) {
if (ids.find((*service)->id) != ids.end()) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Service id 0x%x (%u) is set more than once!\n",
(*service)->id, (*service)->id);
returnCode = -1;
@@ -404,7 +404,7 @@ int main(int argc, char *argv[])
// Get first component of this service
component = getComponent(ensemble->components, (*service)->id);
if (component == ensemble->components.end()) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Service id 0x%x (%u) includes no component!\n",
(*service)->id, (*service)->id);
returnCode = -1;
@@ -422,7 +422,7 @@ int main(int argc, char *argv[])
(*service)->program = false;
break;
default:
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Error, unknown service type: %u\n", (*service)->getType(ensemble));
returnCode = -1;
goto EXIT;
@@ -433,7 +433,7 @@ int main(int argc, char *argv[])
subchannel =
getSubchannel(ensemble->subchannels, (*component)->subchId);
if (subchannel == ensemble->subchannels.end()) {
- etiLog.printHeader(TcpLog::ERR, "Error, service %u component "
+ etiLog.log(error, "Error, service %u component "
"links to the invalid subchannel %u\n",
(*component)->serviceId, (*component)->subchId);
returnCode = -1;
@@ -454,7 +454,7 @@ int main(int argc, char *argv[])
case 3:
break;
default:
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Error, unknown subchannel type\n");
returnCode = -1;
goto EXIT;
@@ -504,19 +504,19 @@ int main(int argc, char *argv[])
(*output)->output = new DabOutputZMQ("epgm");
#endif // defined(HAVE_OUTPUT_ZEROMQ)
} else {
- etiLog.printHeader(TcpLog::ERR, "Output protcol unknown: %s\n",
+ etiLog.log(error, "Output protcol unknown: %s\n",
(*output)->outputProto.c_str());
goto EXIT;
}
if ((*output)->output == NULL) {
- etiLog.printHeader(TcpLog::ERR, "Unable to init output %s://%s\n",
+ etiLog.log(error, "Unable to init output %s://%s\n",
(*output)->outputProto.c_str(), (*output)->outputName.c_str());
return -1;
}
if ((*output)->output->Open((*output)->outputName)
== -1) {
- etiLog.printHeader(TcpLog::ERR, "Unable to open output %s://%s\n",
+ etiLog.log(error, "Unable to open output %s://%s\n",
(*output)->outputProto.c_str(), (*output)->outputName.c_str());
return -1;
}
@@ -545,7 +545,7 @@ int main(int argc, char *argv[])
&(*subchannel)->operations, (*subchannel)->data,
(*subchannel)->bitrate);
if (result <= 0) {
- etiLog.printHeader(TcpLog::ERR, "can't set bitrate for source %s\n",
+ etiLog.log(error, "can't set bitrate for source %s\n",
(*subchannel)->inputName);
returnCode = -1;
goto EXIT;
@@ -566,14 +566,14 @@ int main(int argc, char *argv[])
}
if (ensemble->subchannels.size() == 0) {
- etiLog.printHeader(TcpLog::ERR, "can't multiplexed no subchannel!\n");
+ etiLog.log(error, "can't multiplexed no subchannel!\n");
returnCode = -1;
goto EXIT;
}
subchannel = ensemble->subchannels.end() - 1;
if ((*subchannel)->startAddress + getSizeCu((*subchannel)) > 864) {
- etiLog.printHeader(TcpLog::ERR, "Total size in CU exceeds 864\n");
+ etiLog.log(error, "Total size in CU exceeds 864\n");
printSubchannels(ensemble->subchannels);
returnCode = -1;
goto EXIT;
@@ -587,7 +587,7 @@ int main(int argc, char *argv[])
subchannel = getSubchannel(ensemble->subchannels,
(*component)->subchId);
if (subchannel == ensemble->subchannels.end()) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Subchannel %i does not exist for component "
"of service %i\n",
(*component)->subchId, (*component)->serviceId);
@@ -603,22 +603,22 @@ int main(int argc, char *argv[])
memset(etiFrame, 0, 6144);
// Print settings before starting
- etiLog.printHeader(TcpLog::INFO, "\n--- Multiplex configuration ---\n");
+ etiLog.log(info, "\n--- Multiplex configuration ---\n");
printEnsemble(ensemble);
- etiLog.printHeader(TcpLog::INFO, "\n--- Subchannels list ---\n");
+ etiLog.log(info, "\n--- Subchannels list ---\n");
printSubchannels(ensemble->subchannels);
- etiLog.printHeader(TcpLog::INFO, "\n--- Services list ---\n");
+ etiLog.log(info, "\n--- Services list ---\n");
printServices(ensemble->services);
- etiLog.printHeader(TcpLog::INFO, "\n--- Components list ---\n");
+ etiLog.log(info, "\n--- Components list ---\n");
printComponents(ensemble->components);
- etiLog.printHeader(TcpLog::INFO, "\n--- Output list ---\n");
+ etiLog.log(info, "\n--- Output list ---\n");
printOutputs(outputs);
- etiLog.printHeader(TcpLog::INFO, "\n");
+ etiLog.log(info, "\n");
/***************************************************************************
@@ -973,7 +973,7 @@ int main(int argc, char *argv[])
subchannel = getSubchannel(ensemble->subchannels,
(*component)->subchId);
if (subchannel == ensemble->subchannels.end()) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Subchannel %i does not exist for component "
"of service %i\n",
(*component)->subchId, (*component)->serviceId);
@@ -1009,7 +1009,7 @@ int main(int argc, char *argv[])
packet_description->CA_flag = 0;
break;
default:
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Component type not supported\n");
returnCode = -1;
goto EXIT;
@@ -1018,7 +1018,7 @@ int main(int argc, char *argv[])
fig0_2->Length += 2;
figSize += 2;
if (figSize > 30) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Sorry, no place left in FIG 0/2 to insert "
"component %i of program service %i.\n",
curCpnt, cur);
@@ -1089,7 +1089,7 @@ int main(int argc, char *argv[])
subchannel = getSubchannel(ensemble->subchannels,
(*component)->subchId);
if (subchannel == ensemble->subchannels.end()) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Subchannel %i does not exist for component "
"of service %i\n",
(*component)->subchId, (*component)->serviceId);
@@ -1125,7 +1125,7 @@ int main(int argc, char *argv[])
packet_description->CA_flag = 0;
break;
default:
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Component type not supported\n");
returnCode = -1;
goto EXIT;
@@ -1134,7 +1134,7 @@ int main(int argc, char *argv[])
fig0_2->Length += 2;
figSize += 2;
if (figSize > 30) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Sorry, no place left in FIG 0/2 to insert "
"component %i of data service %i.\n",
curCpnt, cur);
@@ -1155,7 +1155,7 @@ int main(int argc, char *argv[])
subchannel = getSubchannel(ensemble->subchannels,
(*component)->subchId);
if (subchannel == ensemble->subchannels.end()) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Subchannel %i does not exist for component "
"of service %i\n",
(*component)->subchId, (*component)->serviceId);
@@ -1206,7 +1206,7 @@ int main(int argc, char *argv[])
}
if (figSize > 30) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"can't add to Fic Fig 0/3, "
"too much packet service\n");
returnCode = -1;
@@ -1273,7 +1273,7 @@ int main(int argc, char *argv[])
}
if (figSize > 30) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"FIG too big (%i > 30)\n", figSize);
returnCode = -1;
goto EXIT;
@@ -1304,7 +1304,7 @@ int main(int argc, char *argv[])
subchannel = getSubchannel(ensemble->subchannels,
(*componentIndicatorProgram)->subchId);
if (subchannel == ensemble->subchannels.end()) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Subchannel %i does not exist for component "
"of service %i\n",
(*componentIndicatorProgram)->subchId,
@@ -1385,7 +1385,7 @@ int main(int argc, char *argv[])
subchannel = getSubchannel(ensemble->subchannels,
(*componentIndicatorData)->subchId);
if (subchannel == ensemble->subchannels.end()) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Subchannel %i does not exist for component "
"of service %i\n",
(*componentIndicatorData)->subchId,
@@ -1483,7 +1483,7 @@ int main(int argc, char *argv[])
subchannel = getSubchannel(ensemble->subchannels,
(*component)->subchId);
if (subchannel == ensemble->subchannels.end()) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Subchannel %i does not exist for component "
"of service %i\n",
(*component)->subchId, (*component)->serviceId);
@@ -1523,7 +1523,7 @@ int main(int argc, char *argv[])
fig0->Length += 2;
if (figSize > 30) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"can't add to Fic Fig 0/13, "
"too much packet service\n");
returnCode = -1;
@@ -1699,7 +1699,7 @@ int main(int argc, char *argv[])
}
if (ensemble->services.size() > 30) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Sorry, but this software currently can't write "
"Service Label of more than 30 services.\n");
returnCode = -1;
@@ -1731,7 +1731,7 @@ int main(int argc, char *argv[])
(*subchannel)->operations.unlock((*subchannel)->data);
}
if (result < 0) {
- etiLog.print(TcpLog::INFO, "Subchannel %d read failed at ETI frame number: %i\n", (*subchannel)->id, currentFrame);
+ etiLog.log(info, "Subchannel %d read failed at ETI frame number: %i\n", (*subchannel)->id, currentFrame);
}
index += sizeSubchannel;
}
@@ -1795,7 +1795,7 @@ int main(int argc, char *argv[])
for (output = outputs.begin() ; output != outputs.end(); ++output) {
if ((*output)->output->Write(etiFrame, index)
== -1) {
- etiLog.print(TcpLog::ERR, "Can't write to output %s://%s\n",
+ etiLog.log(error, "Can't write to output %s://%s\n",
(*output)->outputProto.c_str(), (*output)->outputName.c_str());
}
}
@@ -1807,12 +1807,12 @@ int main(int argc, char *argv[])
#if _DEBUG
if (currentFrame % 100 == 0) {
if (enableTist) {
- etiLog.print(TcpLog::INFO, "ETI frame number %i Timestamp: %d + %f\n",
+ etiLog.log(info, "ETI frame number %i Timestamp: %d + %f\n",
currentFrame, mnsc_time.tv_sec,
(timestamp & 0xFFFFFF) / 16384000.0);
}
else {
- etiLog.print(TcpLog::INFO, "ETI frame number %i Time: %d, no TIST\n",
+ etiLog.log(info, "ETI frame number %i Time: %d, no TIST\n",
currentFrame, mnsc_time.tv_sec);
}
}
@@ -1820,7 +1820,7 @@ int main(int argc, char *argv[])
}
EXIT:
- etiLog.print(TcpLog::DBG, "exiting...\n");
+ etiLog.log(debug, "exiting...\n");
fflush(stderr);
//fermeture des fichiers
for (subchannel = ensemble->subchannels.begin();
@@ -1849,9 +1849,9 @@ EXIT:
UdpSocket::clean();
if (returnCode < 0) {
- etiLog.print(TcpLog::EMERG, "...aborting\n");
+ etiLog.log(emerg, "...aborting\n");
} else {
- etiLog.print(TcpLog::DBG, "...done\n");
+ etiLog.log(debug, "...done\n");
}
return returnCode;
diff --git a/src/Log.h b/src/Log.h
index e07e825..d28f6c0 100644
--- a/src/Log.h
+++ b/src/Log.h
@@ -108,7 +108,7 @@ class LogToFile : public LogBackend {
{"DEBUG", "INFO", "WARN", "ERROR", "ALERT", "EMERG"};
// fprintf is thread-safe
- fprintf(log_file, "CRC-DABMOD: %s: %s\n",
+ fprintf(log_file, "CRC-DABMUX: %s: %s\n",
log_level_text[(size_t)level], message.c_str());
fflush(log_file);
}
diff --git a/src/MuxElements.cpp b/src/MuxElements.cpp
index 6790874..407c734 100644
--- a/src/MuxElements.cpp
+++ b/src/MuxElements.cpp
@@ -98,19 +98,19 @@ vector<dabService*>::iterator getService(
bool dabComponent::isPacketComponent(vector<dabSubchannel*>& subchannels)
{
if (subchId > 63) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"You must define subchannel id in the "
"packet component before defining packet ");
return false;
}
if (getSubchannel(subchannels, subchId) == subchannels.end()) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Invalid subchannel id in the packet component "
"for defining packet ");
return false;
}
if ((*getSubchannel(subchannels, subchId))->type != 3) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Invalid component type for defining packet ");
return false;
}
@@ -172,7 +172,7 @@ unsigned short getSizeCu(dabSubchannel* subchannel)
return (subchannel->bitrate >> 1);
break;
default: // Should not happens
- etiLog.print(TcpLog::ERR, "Bad protection level on "
+ etiLog.log(error, "Bad protection level on "
"subchannel\n");
return 0;
}
@@ -192,13 +192,13 @@ unsigned short getSizeCu(dabSubchannel* subchannel)
return (subchannel->bitrate * 15) >> 5;
break;
default: // Should not happens
- etiLog.print(TcpLog::ERR,
+ etiLog.log(error,
"Bad protection level on subchannel\n");
return 0;
}
break;
default:
- etiLog.print(TcpLog::ERR, "Invalid protection option\n");
+ etiLog.log(error, "Invalid protection option\n");
return 0;
}
}
diff --git a/src/ParserCmdline.cpp b/src/ParserCmdline.cpp
index 33896b6..44736c3 100644
--- a/src/ParserCmdline.cpp
+++ b/src/ParserCmdline.cpp
@@ -128,7 +128,7 @@ bool parse_cmdline(char **argv,
proto = strstr(optarg, "://");
if (proto == NULL) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"No protocol defined for output\n");
goto EXIT;
} else {
@@ -163,7 +163,7 @@ bool parse_cmdline(char **argv,
break;
case 'C':
if (service == ensemble->services.end()) {
- etiLog.printHeader(TcpLog::ERR, "You must define a service"
+ etiLog.log(error, "You must define a service"
" before using option -%c\n", c);
printUsage(progName);
goto EXIT;
@@ -192,7 +192,7 @@ bool parse_cmdline(char **argv,
case 'P':
case 'T':
if (optarg == NULL && c != 'T') {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Missing parameter for option -%c\n", c);
printUsage(progName);
goto EXIT;
@@ -241,7 +241,7 @@ bool parse_cmdline(char **argv,
(*subchannel)->operations = dabInputDabplusFileOperations;
#endif // defined(HAVE_INPUT_FILE)
} else {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Invalid protocol for DAB+ input (%s)\n",
(*subchannel)->inputProto);
printUsage(progName);
@@ -298,7 +298,7 @@ bool parse_cmdline(char **argv,
} else if (strcmp((*subchannel)->inputProto, "fifo") == 0) {
(*subchannel)->operations = dabInputRawFifoOperations;
} else {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Invalid protocol for data input (%s)\n",
(*subchannel)->inputProto);
printUsage(progName);
@@ -351,7 +351,7 @@ bool parse_cmdline(char **argv,
} else if (strcmp((*subchannel)->inputProto, "file") == 0) {
(*subchannel)->operations = dabInputDmbFileOperations;
} else {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Invalid protocol for DMB input (%s)\n",
(*subchannel)->inputProto);
printUsage(progName);
@@ -362,7 +362,7 @@ bool parse_cmdline(char **argv,
(*subchannel)->bitrate = DEFAULT_DATA_BITRATE;
#endif
} else {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Service '%c' not yet coded!\n", c);
goto EXIT;
}
@@ -390,7 +390,7 @@ bool parse_cmdline(char **argv,
break;
case 'L':
if (optarg == NULL) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Missing parameter for option -L\n");
printUsage(progName);
goto EXIT;
@@ -415,7 +415,7 @@ bool parse_cmdline(char **argv,
goto EXIT;
case 'l':
if (optarg == NULL) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Missing parameter for option -l\n");
printUsage(progName);
goto EXIT;
@@ -435,7 +435,7 @@ bool parse_cmdline(char **argv,
}
}
if (*end != 0) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Error at '%c' in ensemble short label '%s'!\n"
"Not in label '%s'!\n",
*end, optarg, ensemble->label.text);
@@ -449,7 +449,7 @@ bool parse_cmdline(char **argv,
}
}
if (count > 8) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Ensemble short label too long!\n"
"Must be < 8 characters.\n");
goto EXIT;
@@ -469,7 +469,7 @@ bool parse_cmdline(char **argv,
}
}
if (*end != 0) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Error at '%c' in component short label '%s'!\n"
"Not in label '%s'!\n",
*end, optarg, (*component)->label.text);
@@ -483,7 +483,7 @@ bool parse_cmdline(char **argv,
}
}
if (count > 8) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Service '%s' short label too long!\n"
"Must be < 8 characters.\n", (*component)->label.text);
goto EXIT;
@@ -503,7 +503,7 @@ bool parse_cmdline(char **argv,
}
}
if (*end != 0) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Error at '%c' in service short label '%s'!\n"
"Not in label '%s'!\n",
*end, optarg, (*service)->label.text);
@@ -517,7 +517,7 @@ bool parse_cmdline(char **argv,
}
}
if (count > 8) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Service '%s' short label too long!\n"
"Must be < 8 characters.\n", (*service)->label.text);
goto EXIT;
@@ -526,7 +526,7 @@ bool parse_cmdline(char **argv,
break;
case 'i':
if (optarg == NULL) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Missing parameter for option -i\n");
printUsage(progName);
goto EXIT;
@@ -538,7 +538,7 @@ bool parse_cmdline(char **argv,
} else if (service != ensemble->services.end()) {
(*service)->id = strtoul(optarg, NULL, 0);
if ((*service)->id == 0) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Service id 0 is invalid\n");
goto EXIT;
}
@@ -548,13 +548,13 @@ bool parse_cmdline(char **argv,
break;
case 'b':
if (optarg == NULL) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Missing parameter for option -b\n");
printUsage(progName);
goto EXIT;
}
if (subchannel == ensemble->subchannels.end()) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"You must define a subchannel first!\n");
printUsage(progName);
goto EXIT;
@@ -563,14 +563,14 @@ bool parse_cmdline(char **argv,
if (((*subchannel)->bitrate & 0x7) != 0) {
(*subchannel)->bitrate += 8;
(*subchannel)->bitrate &= ~0x7;
- etiLog.printHeader(TcpLog::WARNING,
+ etiLog.log(warn,
"bitrate must be multiple of 8 -> ceiling to %i\n",
(*subchannel)->bitrate);
}
break;
case 'c':
if (optarg == NULL) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Missing parameter for option -c\n");
printUsage(progName);
goto EXIT;
@@ -580,7 +580,7 @@ bool parse_cmdline(char **argv,
#if defined(HAVE_INPUT_FIFO) && defined(HAVE_INPUT_FILE)
case 'k':
if (subchannel == ensemble->subchannels.end()) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"You must define a subchannel first!\n");
printUsage(progName);
goto EXIT;
@@ -596,7 +596,7 @@ bool parse_cmdline(char **argv,
(*subchannel)->operations = dabInputEnhancedFifoOperations;
#endif // defined(HAVE_FORMAT_EPM)
} else {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Error, wrong packet subchannel operations!\n");
goto EXIT;
}
@@ -613,7 +613,7 @@ bool parse_cmdline(char **argv,
dabInputDabplusFileOperations) {
(*subchannel)->operations = dabInputDabplusFifoOperations;
} else {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Error, wrong audio subchannel operations!\n");
goto EXIT;
}
@@ -622,7 +622,7 @@ bool parse_cmdline(char **argv,
break;
#endif // defined(HAVE_FORMAT_MPEG)
default:
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"sorry, non-blocking input file is "
"only valid with audio or packet services\n");
goto EXIT;
@@ -632,13 +632,13 @@ bool parse_cmdline(char **argv,
case 'p':
int level;
if (optarg == NULL) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Missing parameter for option -P\n");
printUsage(progName);
goto EXIT;
}
if (subchannel == ensemble->subchannels.end()) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"You must define a subchannel first!\n");
printUsage(progName);
goto EXIT;
@@ -646,14 +646,14 @@ bool parse_cmdline(char **argv,
level = strtoul(optarg, NULL, 0) - 1;
if (protection->form == 0) {
if ((level < 0) || (level > 4)) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"protection level must be between "
"1 to 5 inclusively (current = %i)\n", level);
goto EXIT;
}
} else {
if ((level < 0) || (level > 3)) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"protection level must be between "
"1 to 4 inclusively (current = %i)\n", level);
goto EXIT;
@@ -665,7 +665,7 @@ bool parse_cmdline(char **argv,
if (optarg) {
ensemble->mode = strtoul(optarg, NULL, 0);
if ((ensemble->mode < 1) || (ensemble->mode > 4)) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Mode must be between 1-4\n");
goto EXIT;
}
@@ -677,7 +677,7 @@ bool parse_cmdline(char **argv,
*FICL = 24;
}
} else {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Missing parameter for option -m\n");
printUsage(progName);
goto EXIT;
@@ -687,24 +687,24 @@ bool parse_cmdline(char **argv,
if (optarg) {
*limit = strtoul(optarg, NULL, 0);
} else {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Missing parameter for option -n\n");
printUsage(progName);
goto EXIT;
}
break;
case 'o':
- etiLog.open("createETI", 0, 12222);
+ etiLog.register_backend(new LogToSyslog()); // TODO don't leak the LogToSyslog backend
break;
case 't':
if (optarg == NULL) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Missing parameter for option -t\n");
printUsage(progName);
goto EXIT;
}
if (component == ensemble->components.end()) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"You must define a component before setting "
"service type!\n");
printUsage(progName);
@@ -714,14 +714,14 @@ bool parse_cmdline(char **argv,
break;
case 'a':
if (component == ensemble->components.end()) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"You must define a component before setting "
"packet address!\n");
printUsage(progName);
goto EXIT;
}
if (!(*component)->isPacketComponent(ensemble->subchannels)) {
- etiLog.printHeader(TcpLog::ERR, "address\n");
+ etiLog.log(error, "address\n");
printUsage(progName);
goto EXIT;
}
@@ -729,14 +729,14 @@ bool parse_cmdline(char **argv,
break;
case 'd':
if (component == ensemble->components.end()) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"You must define a component before setting "
"datagroup!\n");
printUsage(progName);
goto EXIT;
}
if (!(*component)->isPacketComponent(ensemble->subchannels)) {
- etiLog.printHeader(TcpLog::ERR, "datagroup\n");
+ etiLog.log(error, "datagroup\n");
printUsage(progName);
goto EXIT;
}
@@ -744,13 +744,13 @@ bool parse_cmdline(char **argv,
break;
case 'f':
if (component == ensemble->components.end()) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"You must define a component first!\n");
printUsage(progName);
goto EXIT;
}
if (!(*component)->isPacketComponent(ensemble->subchannels)) {
- etiLog.printHeader(TcpLog::ERR, "application type\n");
+ etiLog.log(error, "application type\n");
printUsage(progName);
goto EXIT;
}
@@ -758,7 +758,7 @@ bool parse_cmdline(char **argv,
break;
case 'g':
if (service == ensemble->services.end()) {
- etiLog.printHeader(TcpLog::ERR, "You must define a service"
+ etiLog.log(error, "You must define a service"
" before using option -%c\n", c);
printUsage(progName);
goto EXIT;
@@ -782,7 +782,7 @@ bool parse_cmdline(char **argv,
break;
case 'y':
if (service == ensemble->services.end()) {
- etiLog.printHeader(TcpLog::ERR, "You must define a service"
+ etiLog.log(error, "You must define a service"
" before using option -%c\n", c);
printUsage(progName);
goto EXIT;
@@ -793,7 +793,7 @@ bool parse_cmdline(char **argv,
*factumAnalyzer = true;
break;
case 'r':
- etiLog.printHeader(TcpLog::INFO,
+ etiLog.log(info,
"Enabling throttled output using simul, one frame every 24ms\n");
outputs.push_back(new dabOutput("simul", NULL));
output = outputs.end() - 1;
@@ -808,16 +808,16 @@ bool parse_cmdline(char **argv,
printUsage(progName, stdout);
goto EXIT;
default:
- etiLog.printHeader(TcpLog::ERR, "Option '%c' not coded yet\n", c);
+ etiLog.log(error, "Option '%c' not coded yet\n", c);
goto EXIT;
}
}
if (optind < argc) {
- etiLog.printHeader(TcpLog::ERR, "Too much parameters:");
+ etiLog.log(error, "Too much parameters:");
while (optind < argc) {
- etiLog.printHeader(TcpLog::ERR, " %s", argv[optind++]);
+ etiLog.log(error, " %s", argv[optind++]);
}
- etiLog.printHeader(TcpLog::ERR, "\n");
+ etiLog.log(error, "\n");
printUsage(progName);
goto EXIT;
}
diff --git a/src/ParserConfigfile.cpp b/src/ParserConfigfile.cpp
index dcf6733..ca9983b 100644
--- a/src/ParserConfigfile.cpp
+++ b/src/ParserConfigfile.cpp
@@ -174,9 +174,9 @@ void parse_configfile(string configuration_file,
/* Number of frames to generate */
*limit = pt_general.get("nbframes", 0);
- /* Enable TCPLog conditionally */
- if (pt_general.get("tcplog", 0)) {
- etiLog.open("createETI", 0, 12222);
+ /* Enable Logging to syslog conditionally */
+ if (pt_general.get("syslog", 0)) {
+ etiLog.register_backend(new LogToSyslog()); // TODO don't leak the LogToSyslog backend
}
*factumAnalyzer = pt_general.get("writescca", false);
@@ -236,7 +236,7 @@ void parse_configfile(string configuration_file,
set_short_label(service->label, label, "Service");
}
catch (ptree_error &e) {
- etiLog.printHeader(TcpLog::WARNING,
+ etiLog.log(warn,
"Service with uid %s has no short label.\n", serviceuid.c_str());
}
@@ -274,7 +274,7 @@ void parse_configfile(string configuration_file,
setup_subchannel_from_ptree(subchan, it->second, ensemble, subchanuid);
}
catch (runtime_error &e) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"%s\n", e.what());
throw e;
}
@@ -350,7 +350,7 @@ void parse_configfile(string configuration_file,
component->label.flag = 0xff00;
}
catch (ptree_error &e) {
- etiLog.printHeader(TcpLog::WARNING,
+ etiLog.log(warn,
"Service with uid %s has no label.\n", componentuid.c_str());
}
@@ -359,7 +359,7 @@ void parse_configfile(string configuration_file,
set_short_label(component->label, label, "Component");
}
catch (ptree_error &e) {
- etiLog.printHeader(TcpLog::WARNING,
+ etiLog.log(warn,
"Component with uid %s has no short label.\n", componentuid.c_str());
}
@@ -482,12 +482,12 @@ void setup_subchannel_from_ptree(dabSubchannel* subchan,
subchan->operations = dabInputZmqOperations;
}
else if (strcmp(subchan->inputProto, "epmg") == 0) {
- etiLog.printHeader(TcpLog::WARNING,
+ etiLog.log(warn,
"Using untested epmg:// zeromq input\n");
subchan->operations = dabInputZmqOperations;
}
else if (strcmp(subchan->inputProto, "ipc") == 0) {
- etiLog.printHeader(TcpLog::WARNING,
+ etiLog.log(warn,
"Using untested ipc:// zeromq input\n");
subchan->operations = dabInputZmqOperations;
#endif // defined(HAVE_INPUT_ZEROMQ)
@@ -657,7 +657,7 @@ void setup_subchannel_from_ptree(dabSubchannel* subchan,
subchan->operations = dabInputEnhancedFifoOperations;
#endif // defined(HAVE_FORMAT_EPM)
} else {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Error, wrong packet subchannel operations!\n");
throw runtime_error("Error, wrong packet subchannel operations!\n");
}
@@ -674,7 +674,7 @@ void setup_subchannel_from_ptree(dabSubchannel* subchan,
dabInputDabplusFileOperations) {
subchan->operations = dabInputDabplusFifoOperations;
} else {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Error, wrong audio subchannel operations!\n");
throw runtime_error(
"Error, wrong audio subchannel operations!\n");
diff --git a/src/dabInput.cpp b/src/dabInput.cpp
index fa3eece..1ec7c51 100644
--- a/src/dabInput.cpp
+++ b/src/dabInput.cpp
@@ -20,6 +20,7 @@
*/
#include "dabInput.h"
+#include "Log.h"
#include <string.h>
@@ -38,7 +39,7 @@ int dabInputSetbuf(void* args, int size)
int dabInputSetbitrate(dabInputOperations* ops, void* args, int bitrate)
{
if (bitrate <= 0) {
- etiLog.print(TcpLog::ERR, "Invalid bitrate (%i)\n", bitrate);
+ etiLog.log(error, "Invalid bitrate (%i)\n", bitrate);
return -1;
}
if (ops->setbuf(args, bitrate * 3) == 0) {
diff --git a/src/dabInputBridgeUdp.cpp b/src/dabInputBridgeUdp.cpp
index a2ccf85..cc73adb 100644
--- a/src/dabInputBridgeUdp.cpp
+++ b/src/dabInputBridgeUdp.cpp
@@ -90,14 +90,14 @@ int dabInputBridgeUdpRead(dabInputOperations* ops, void* args, void* buffer, int
}
if (++stats->frameCount == NB_RECORDS) {
- etiLog.print(TcpLog::INFO, "Data subchannel usage: (%i)",
+ etiLog.log(info, "Data subchannel usage: (%i)",
stats->id);
for (int i = 0; i < stats->frameCount; ++i) {
- etiLog.print(TcpLog::INFO, " %i/%i",
+ etiLog.log(info, " %i/%i",
stats->frameRecords[i].curSize,
stats->frameRecords[i].maxSize);
}
- etiLog.print(TcpLog::INFO, "\n");
+ etiLog.log(info, "\n");
stats->frameCount = 0;
}
return size;
diff --git a/src/dabInputDabplusFifo.cpp b/src/dabInputDabplusFifo.cpp
index fdff5ad..48c25b7 100644
--- a/src/dabInputDabplusFifo.cpp
+++ b/src/dabInputDabplusFifo.cpp
@@ -115,7 +115,7 @@ int dabInputDabplusFifoRead(void* args, void* buffer, int size)
}
data->bufferOffset += ret;
if (data->bufferOffset != data->bufferSize) {
- etiLog.print(TcpLog::CRIT, "ERROR: Incomplete DAB+ frame!\n");
+ etiLog.log(alert, "ERROR: Incomplete DAB+ frame!\n");
return 0;
}
}
diff --git a/src/dabInputDabplusFile.cpp b/src/dabInputDabplusFile.cpp
index 8d46ea1..1a56346 100644
--- a/src/dabInputDabplusFile.cpp
+++ b/src/dabInputDabplusFile.cpp
@@ -92,7 +92,7 @@ int dabInputDabplusFileRead(void* args, void* buffer, int size)
int ret = read(data->file, data->buffer, data->bufferSize);
if (ret != data->bufferSize) {
if (ret != 0) {
- etiLog.print(TcpLog::CRIT, "ERROR: Incomplete DAB+ frame!\n");
+ etiLog.log(alert, "ERROR: Incomplete DAB+ frame!\n");
}
return 0;
}
@@ -115,27 +115,27 @@ int dabInputDabplusFileReadFrame(dabInputOperations* ops, void* args,
result = ops->read(args, dataOut, size);
if (result == -1) {
- etiLog.print(TcpLog::CRIT, "ERROR: Can't read file\n");
+ etiLog.log(alert, "ERROR: Can't read file\n");
perror("");
return -1;
}
if (result < size) {
int sizeOut = result;
- etiLog.print(TcpLog::NOTICE, "reach end of file -> rewinding\n");
+ etiLog.log(info, "reach end of file -> rewinding\n");
if (ops->rewind(args) == -1) {
- etiLog.print(TcpLog::CRIT, "ERROR: Can't rewind file\n");
+ etiLog.log(alert, "ERROR: Can't rewind file\n");
return -1;
}
result = ops->read(args, dataOut + sizeOut, size - sizeOut);
if (result == -1) {
- etiLog.print(TcpLog::CRIT, "ERROR: Can't read file\n");
+ etiLog.log(alert, "ERROR: Can't read file\n");
perror("");
return -1;
}
if (result < size) {
- etiLog.print(TcpLog::CRIT, "ERROR: Not enought data in file\n");
+ etiLog.log(alert, "ERROR: Not enought data in file\n");
return -1;
}
}
diff --git a/src/dabInputDmbFile.cpp b/src/dabInputDmbFile.cpp
index a057764..a39878c 100644
--- a/src/dabInputDmbFile.cpp
+++ b/src/dabInputDmbFile.cpp
@@ -106,7 +106,7 @@ int dabInputDmbFileRead(dabInputOperations* ops, void* args, void* buffer, int s
input->stats.frameRecords[input->stats.frameCount].curSize = nbBytes;
input->bufferLength = fread(input->buffer, 188, 1, input->file);
if (input->bufferLength == 0) {
- etiLog.print(TcpLog::NOTICE, "reach end of file -> rewinding\n");
+ etiLog.log(info, "reach end of file -> rewinding\n");
if (fseek(input->file, 0, SEEK_SET) == 0) {
input->bufferLength = fread(input->buffer, 188, 1, input->file);
}
@@ -120,14 +120,14 @@ int dabInputDmbFileRead(dabInputOperations* ops, void* args, void* buffer, int s
}
if (++stats->frameCount == NB_RECORDS) {
- etiLog.print(TcpLog::INFO, "Data subchannel usage: (%i)",
+ etiLog.log(info, "Data subchannel usage: (%i)",
stats->id);
for (int i = 0; i < stats->frameCount; ++i) {
- etiLog.print(TcpLog::INFO, " %i/%i",
+ etiLog.log(info, " %i/%i",
stats->frameRecords[i].curSize,
stats->frameRecords[i].maxSize);
}
- etiLog.print(TcpLog::INFO, "\n");
+ etiLog.log(info, "\n");
stats->frameCount = 0;
}
return size;
diff --git a/src/dabInputDmbUdp.cpp b/src/dabInputDmbUdp.cpp
index 935e925..859d27b 100644
--- a/src/dabInputDmbUdp.cpp
+++ b/src/dabInputDmbUdp.cpp
@@ -79,7 +79,7 @@ int dabInputDmbUdpOpen(void* args, const char* inputName)
address = strdup(inputName);
ptr = strchr(address, ':');
if (ptr == NULL) {
- etiLog.print(TcpLog::ERR,
+ etiLog.log(error,
"\"%s\" is an invalid format for udp address: "
"should be [address]:port - > aborting\n", address);
returnCode = -1;
@@ -87,25 +87,25 @@ int dabInputDmbUdpOpen(void* args, const char* inputName)
*(ptr++) = 0;
port = strtol(ptr, (char **)NULL, 10);
if ((port == LONG_MIN) || (port == LONG_MAX)) {
- etiLog.print(TcpLog::ERR,
+ etiLog.log(error,
"can't convert port number in udp address %s\n",
address);
returnCode = -1;
}
if (port == 0) {
- etiLog.print(TcpLog::ERR, "can't use port number 0 in udp address\n");
+ etiLog.log(error, "can't use port number 0 in udp address\n");
returnCode = -1;
}
dabInputDmbUdpData* input = (dabInputDmbUdpData*)args;
if (input->socket->create(port) == -1) {
- etiLog.print(TcpLog::ERR, "can't set port %i on Dmb input (%s: %s)\n",
+ etiLog.log(error, "can't set port %i on Dmb input (%s: %s)\n",
port, inetErrDesc, inetErrMsg);
returnCode = -1;
}
if (*address != 0) {
if (input->socket->joinGroup(address) == -1) {
- etiLog.print(TcpLog::ERR,
+ etiLog.log(error,
"can't join multicast group %s (%s: %s)\n",
address, inetErrDesc, inetErrMsg);
returnCode = -1;
@@ -113,13 +113,13 @@ int dabInputDmbUdpOpen(void* args, const char* inputName)
}
if (input->socket->setBlocking(false) == -1) {
- etiLog.print(TcpLog::ERR, "can't set Dmb input socket in blocking mode "
+ etiLog.log(error, "can't set Dmb input socket in blocking mode "
"(%s: %s)\n", inetErrDesc, inetErrMsg);
returnCode = -1;
}
free(address);
- etiLog.print(TcpLog::DBG, "check return code of create\n");
+ etiLog.log(debug, "check return code of create\n");
return returnCode;;
}
@@ -156,14 +156,14 @@ int dabInputDmbUdpRead(dabInputOperations* ops, void* args, void* buffer, int si
}
if (++stats->frameCount == NB_RECORDS) {
- etiLog.print(TcpLog::INFO, "Data subchannel usage: (%i)",
+ etiLog.log(info, "Data subchannel usage: (%i)",
stats->id);
for (int i = 0; i < stats->frameCount; ++i) {
- etiLog.print(TcpLog::INFO, " %i/%i",
+ etiLog.log(info, " %i/%i",
stats->frameRecords[i].curSize,
stats->frameRecords[i].maxSize);
}
- etiLog.print(TcpLog::INFO, "\n");
+ etiLog.log(info, "\n");
stats->frameCount = 0;
}
return size;
diff --git a/src/dabInputFifo.cpp b/src/dabInputFifo.cpp
index a2c2ef7..7b2a30f 100644
--- a/src/dabInputFifo.cpp
+++ b/src/dabInputFifo.cpp
@@ -212,7 +212,7 @@ int dabInputFifoRead(void* args, void* buffer, int size)
if (curSize == 0) {
stats->empty = true;
} else {
- etiLog.print(TcpLog::WARNING, "Not enough data in FIFO buffer: (%i) %i/%i\n",
+ etiLog.log(warn, "Not enough data in FIFO buffer: (%i) %i/%i\n",
data->stats.id, curSize, size);
}
return 0;
@@ -292,31 +292,31 @@ int dabInputFifoLock(void* args) {
stats->bufferRecords[stats->bufferCount].maxSize = maxSize;
if (++stats->bufferCount == NB_RECORDS) {
- etiLog.print(TcpLog::INFO, "FIFO buffer state: (%i)", stats->id);
+ etiLog.log(info, "FIFO buffer state: (%i)", stats->id);
for (int i = 0; i < stats->bufferCount; ++i) {
- etiLog.print(TcpLog::INFO, " %i/%i",
+ etiLog.log(info, " %i/%i",
stats->bufferRecords[i].curSize,
stats->bufferRecords[i].maxSize);
}
- etiLog.print(TcpLog::INFO, "\n");
+ etiLog.log(info, "\n");
if (stats->full) {
- etiLog.print(TcpLog::WARNING, "FIFO buffer full: (%i)\n",
+ etiLog.log(warn, "FIFO buffer full: (%i)\n",
data->stats.id);
stats->full = false;
}
if (stats->empty) {
- etiLog.print(TcpLog::WARNING, "FIFO buffer empty: (%i)\n",
+ etiLog.log(warn, "FIFO buffer empty: (%i)\n",
data->stats.id);
stats->empty = false;
}
if (stats->error) {
- etiLog.print(TcpLog::ERR, "FIFO input read error: (%i)\n",
+ etiLog.log(error, "FIFO input read error: (%i)\n",
data->stats.id);
stats->error = false;
}
if (stats->input) {
- etiLog.print(TcpLog::ERR, "FIFO input not connected: (%i)\n",
+ etiLog.log(error, "FIFO input not connected: (%i)\n",
data->stats.id);
stats->input = false;
}
@@ -352,7 +352,7 @@ int dabInputFifoClean(void** args)
{
dabInputFifoData* data = (dabInputFifoData*)*args;
data->running = false;
- etiLog.print(TcpLog::DBG, "Wait FIFO child...\n");
+ etiLog.log(debug, "Wait FIFO child...\n");
#ifdef WIN32
DWORD status;
for (int i = 0; i < 5; ++i) {
@@ -363,16 +363,16 @@ int dabInputFifoClean(void** args)
}
TerminateThread(data->thread, 1);
if (CloseHandle(data->thread) == 0) {
- etiLog.print(TcpLog::DBG, "ERROR: Failed to close FIFO child thread\n");
+ etiLog.log(debug, "ERROR: Failed to close FIFO child thread\n");
}
#else
if (data->thread != (pthread_t)NULL) {
if (pthread_join(data->thread, NULL)) {
- etiLog.print(TcpLog::DBG, "ERROR: FIFO child thread had not exit normally\n");
+ etiLog.log(debug, "ERROR: FIFO child thread had not exit normally\n");
}
}
#endif
- etiLog.print(TcpLog::DBG, "Done\n");
+ etiLog.log(debug, "Done\n");
#ifdef _WIN32
CloseHandle(data->semInfo);
CloseHandle(data->semFull);
diff --git a/src/dabInputMpegFile.cpp b/src/dabInputMpegFile.cpp
index 0a06b2f..5bd31e2 100644
--- a/src/dabInputMpegFile.cpp
+++ b/src/dabInputMpegFile.cpp
@@ -100,73 +100,73 @@ READ_SUBCHANNEL:
}
switch (result) {
case MPEG_BUFFER_UNDERFLOW:
- etiLog.print(TcpLog::WARNING, "data underflow -> frame muted\n");
+ etiLog.log(warn, "data underflow -> frame muted\n");
goto MUTE_SUBCHANNEL;
case MPEG_BUFFER_OVERFLOW:
- etiLog.print(TcpLog::WARNING, "bitrate too high -> frame muted\n");
+ etiLog.log(warn, "bitrate too high -> frame muted\n");
goto MUTE_SUBCHANNEL;
case MPEG_FILE_EMPTY:
if (rewind) {
- etiLog.print(TcpLog::ERR, "file rewinded and still empty "
+ etiLog.log(error, "file rewinded and still empty "
"-> frame muted\n");
goto MUTE_SUBCHANNEL;
} else {
rewind = true;
- etiLog.print(TcpLog::NOTICE, "reach end of file -> rewinding\n");
+ etiLog.log(info, "reach end of file -> rewinding\n");
lseek(data->file, 0, SEEK_SET);
goto READ_SUBCHANNEL;
}
case MPEG_FILE_ERROR:
- etiLog.print(TcpLog::CRIT, "can't read file (%i) -> frame muted\n", errno);
+ etiLog.log(alert, "can't read file (%i) -> frame muted\n", errno);
perror("");
goto MUTE_SUBCHANNEL;
case MPEG_SYNC_NOT_FOUND:
- etiLog.print(TcpLog::CRIT, "mpeg sync not found, maybe is not a valid file "
+ etiLog.log(alert, "mpeg sync not found, maybe is not a valid file "
"-> frame muted\n");
goto MUTE_SUBCHANNEL;
case MPEG_INVALID_FRAME:
- etiLog.print(TcpLog::CRIT, "file is not a valid mpeg file "
+ etiLog.log(alert, "file is not a valid mpeg file "
"-> frame muted\n");
goto MUTE_SUBCHANNEL;
default:
if (result < 0) {
- etiLog.print(TcpLog::CRIT,
+ etiLog.log(alert,
"unknown error (code = %i) -> frame muted\n",
result);
MUTE_SUBCHANNEL:
memset(buffer, 0, size);
} else {
if (result < size) {
- etiLog.print(TcpLog::WARNING, "bitrate too low from file "
+ etiLog.log(warn, "bitrate too low from file "
"-> frame padded\n");
memset((char*)buffer + result, 0, size - result);
}
result = checkDabMpegFrame(buffer);
switch (result) {
case MPEG_FREQUENCY:
- etiLog.print(TcpLog::ERR, "file has a frame with an invalid "
+ etiLog.log(error, "file has a frame with an invalid "
"frequency: %i, should be 48000 or 24000\n",
getMpegFrequency(buffer));
break;
case MPEG_PADDING:
- etiLog.print(TcpLog::WARNING,
+ etiLog.log(warn,
"file has a frame with padding bit set\n");
break;
case MPEG_COPYRIGHT:
- etiLog.print(TcpLog::WARNING,
+ etiLog.log(warn,
"file has a frame with copyright bit set\n");
break;
case MPEG_ORIGINAL:
- etiLog.print(TcpLog::WARNING,
+ etiLog.log(warn,
"file has a frame with original bit set\n");
break;
case MPEG_EMPHASIS:
- etiLog.print(TcpLog::WARNING,
+ etiLog.log(warn,
"file has a frame with emphasis bits set\n");
break;
default:
if (result < 0) {
- etiLog.print(TcpLog::CRIT, "mpeg file has an invalid DAB "
+ etiLog.log(alert, "mpeg file has an invalid DAB "
"mpeg frame (unknown reason: %i)\n", result);
}
break;
diff --git a/src/dabInputPacketFile.cpp b/src/dabInputPacketFile.cpp
index 65b5ebe..0dc157d 100644
--- a/src/dabInputPacketFile.cpp
+++ b/src/dabInputPacketFile.cpp
@@ -166,7 +166,7 @@ int dabInputPacketFileRead(dabInputOperations* ops, void* args, void* buffer,
}
continue;
} else if (nbBytes < 3) {
- etiLog.print(TcpLog::ERR,
+ etiLog.log(error,
"Error while reading file for packet header; "
"read %i out of 3 bytes\n", nbBytes);
break;
@@ -192,14 +192,14 @@ int dabInputPacketFileRead(dabInputOperations* ops, void* args, void* buffer,
perror("Packet file");
return -1;
} else if (nbBytes == 0) {
- etiLog.print(TcpLog::NOTICE,
+ etiLog.log(info,
"Packet header read, but no data!\n");
if (ops->rewind(args) == -1) {
goto END_PACKET;
}
continue;
} else if (nbBytes < length - 3) {
- etiLog.print(TcpLog::ERR, "Error while reading packet file; "
+ etiLog.log(error, "Error while reading packet file; "
"read %i out of %i bytes\n", nbBytes, length - 3);
break;
}
@@ -216,7 +216,7 @@ int dabInputPacketFileRead(dabInputOperations* ops, void* args, void* buffer,
data->enhancedPacketLength += length;
if (data->enhancedPacketLength >= (12 * 188)) {
if (data->enhancedPacketLength > (12 * 188)) {
- etiLog.print(TcpLog::ERR,
+ etiLog.log(error,
"Error, too much enhanced packet data!\n");
}
ReedSolomon encoder(204, 188);
@@ -237,14 +237,14 @@ END_PACKET:
fifoStats->frameRecords[fifoStats->frameCount].curSize = written;
fifoStats->frameRecords[fifoStats->frameCount].maxSize = size;
if (++fifoStats->frameCount == NB_RECORDS) {
- etiLog.print(TcpLog::INFO, "Packet subchannel usage: (%i)",
+ etiLog.log(info, "Packet subchannel usage: (%i)",
fifoStats->id);
for (int i = 0; i < fifoStats->frameCount; ++i) {
- etiLog.print(TcpLog::INFO, " %i/%i",
+ etiLog.log(info, " %i/%i",
fifoStats->frameRecords[i].curSize,
fifoStats->frameRecords[i].maxSize);
}
- etiLog.print(TcpLog::INFO, "\n");
+ etiLog.log(info, "\n");
fifoStats->frameCount = 0;
}
}
diff --git a/src/dabInputPrbs.cpp b/src/dabInputPrbs.cpp
index 3b7a0dc..b6455ed 100644
--- a/src/dabInputPrbs.cpp
+++ b/src/dabInputPrbs.cpp
@@ -61,7 +61,7 @@ int dabInputPrbsOpen(void* args, const char* name)
prbs_data* data = (prbs_data*)args;
if (*name != ':') {
- etiLog.print(TcpLog::ERR,
+ etiLog.log(error,
"Sorry, PRBS address format is prbs://:polynomial.\n");
errno = EINVAL;
return -1;
@@ -69,12 +69,12 @@ int dabInputPrbsOpen(void* args, const char* name)
long polynomial = strtol(++name, (char **)NULL, 10);
if ((polynomial == LONG_MIN) || (polynomial == LONG_MAX)) {
- etiLog.print(TcpLog::ERR, "can't convert polynomial number %s\n", name);
+ etiLog.log(error, "can't convert polynomial number %s\n", name);
errno = EINVAL;
return -1;
}
if (polynomial == 0) {
- etiLog.print(TcpLog::ERR, "you must specify a polynomial number\n");
+ etiLog.log(error, "you must specify a polynomial number\n");
errno = EINVAL;
return -1;
}
diff --git a/src/dabInputRawFifo.cpp b/src/dabInputRawFifo.cpp
index b40e14d..7076143 100644
--- a/src/dabInputRawFifo.cpp
+++ b/src/dabInputRawFifo.cpp
@@ -125,7 +125,7 @@ int dabInputRawFifoReadFrame(dabInputOperations* ops, void* args,
result = ops->read(args, data->buffer + data->bufferOffset, size - data->bufferOffset);
if (result == -1) {
- etiLog.print(TcpLog::CRIT, "ERROR: Can't read fifo\n");
+ etiLog.log(alert, "ERROR: Can't read fifo\n");
perror("");
return -1;
}
@@ -133,21 +133,21 @@ int dabInputRawFifoReadFrame(dabInputOperations* ops, void* args,
if (result + data->bufferOffset < size) {
data->bufferOffset += result;
- etiLog.print(TcpLog::NOTICE, "reach end of fifo -> rewinding\n");
+ etiLog.log(info, "reach end of fifo -> rewinding\n");
if (ops->rewind(args) == -1) {
- etiLog.print(TcpLog::CRIT, "ERROR: Can't rewind fifo\n");
+ etiLog.log(alert, "ERROR: Can't rewind fifo\n");
return -1;
}
result = ops->read(args, data->buffer + data->bufferOffset, size - data->bufferOffset);
if (result == -1) {
- etiLog.print(TcpLog::CRIT, "ERROR: Can't read fifo\n");
+ etiLog.log(alert, "ERROR: Can't read fifo\n");
perror("");
return -1;
}
if (result < size) {
- etiLog.print(TcpLog::CRIT, "ERROR: Not enought data in fifo\n");
+ etiLog.log(alert, "ERROR: Not enought data in fifo\n");
return 0;
}
}
diff --git a/src/dabInputRawFile.cpp b/src/dabInputRawFile.cpp
index 17be73c..1cc06a9 100644
--- a/src/dabInputRawFile.cpp
+++ b/src/dabInputRawFile.cpp
@@ -47,7 +47,7 @@ int dabInputRawFileRead(dabInputOperations* ops, void* args, void* buffer,
{
int ret = ops->read(args, buffer, size);
if (ret == 0) {
- etiLog.print(TcpLog::NOTICE, "reach end of raw file -> rewinding\n");
+ etiLog.log(info, "reach end of raw file -> rewinding\n");
ops->rewind(args);
ret = ops->read(args, buffer, size);
}
diff --git a/src/dabInputSlip.cpp b/src/dabInputSlip.cpp
index 7663d2c..52b9280 100644
--- a/src/dabInputSlip.cpp
+++ b/src/dabInputSlip.cpp
@@ -128,7 +128,7 @@ void* dabInputSlipThread(void* args)
while ((client = data->server->accept()) != NULL) {
int size = 0;
- etiLog.print(TcpLog::INFO, "SLIP server got a new client.\n");
+ etiLog.log(info, "SLIP server got a new client.\n");
#ifdef _WIN32
WaitForSingleObject(data->semWrite, INFINITE);
@@ -173,10 +173,10 @@ void* dabInputSlipThread(void* args)
sem_post(&data->semQueue);
#endif
}
- etiLog.print(TcpLog::INFO, "SLIP server client deconnected.\n");
+ etiLog.log(info, "SLIP server client deconnected.\n");
client->close();
}
- etiLog.print(TcpLog::ERR, "SLIP thread can't accept new client (%s)\n",
+ etiLog.log(error, "SLIP thread can't accept new client (%s)\n",
inetErrDesc, inetErrMsg);
return NULL;
@@ -189,30 +189,30 @@ int dabInputSlipOpen(void* args, const char* inputName)
long port;
address = strchr(inputName, ':');
if (address == NULL) {
- etiLog.print(TcpLog::ERR, "\"%s\" SLIP address format is invalid: "
+ etiLog.log(error, "\"%s\" SLIP address format is invalid: "
"should be [address]:port - > aborting\n", inputName);
return -1;
}
++address;
port = strtol(address, (char **)NULL, 10);
if ((port == LONG_MIN) || (port == LONG_MAX)) {
- etiLog.print(TcpLog::ERR, "can't convert port number in SLIP address %s\n",
+ etiLog.log(error, "can't convert port number in SLIP address %s\n",
address);
return -1;
}
if (port == 0) {
- etiLog.print(TcpLog::ERR, "can't use port number 0 in SLIP address\n");
+ etiLog.log(error, "can't use port number 0 in SLIP address\n");
return -1;
}
dabInputSlipData* data = (dabInputSlipData*)args;
if (data->server->create(port) == -1) {
- etiLog.print(TcpLog::ERR, "can't set port %i on SLIP input (%s: %s)\n",
+ etiLog.log(error, "can't set port %i on SLIP input (%s: %s)\n",
port, inetErrDesc, inetErrMsg);
return -1;
}
if (data->server->listen() == -1) {
- etiLog.print(TcpLog::ERR, "can't listen on SLIP socket(%s: %s)\n",
+ etiLog.log(error, "can't listen on SLIP socket(%s: %s)\n",
inetErrDesc, inetErrMsg);
return -1;
}
@@ -229,7 +229,7 @@ int dabInputSlipOpen(void* args, const char* inputName)
}
#endif
- etiLog.print(TcpLog::DBG, "check return code of create\n");
+ etiLog.log(debug, "check return code of create\n");
return 0;
}
@@ -316,13 +316,13 @@ int dabInputSlipReadFrame(dabInputOperations* ops, void* args, void* buffer, int
sem_post(&data->semQueue);
#endif
if (++stats->bufferCount == NB_RECORDS) {
- etiLog.print(TcpLog::INFO, "SLIP buffer state: (%i)", stats->id);
+ etiLog.log(info, "SLIP buffer state: (%i)", stats->id);
for (int i = 0; i < stats->bufferCount; ++i) {
- etiLog.print(TcpLog::INFO, " %i/%i",
+ etiLog.log(info, " %i/%i",
stats->bufferRecords[i].curSize,
stats->bufferRecords[i].maxSize);
}
- etiLog.print(TcpLog::INFO, "\n");
+ etiLog.log(info, "\n");
stats->bufferCount = 0;
}
@@ -345,14 +345,14 @@ int dabInputSlipReadFrame(dabInputOperations* ops, void* args, void* buffer, int
}
if (++stats->frameCount == NB_RECORDS) {
- etiLog.print(TcpLog::INFO, "Data subchannel usage: (%i)",
+ etiLog.log(info, "Data subchannel usage: (%i)",
stats->id);
for (int i = 0; i < stats->frameCount; ++i) {
- etiLog.print(TcpLog::INFO, " %i/%i",
+ etiLog.log(info, " %i/%i",
stats->frameRecords[i].curSize,
stats->frameRecords[i].maxSize);
}
- etiLog.print(TcpLog::INFO, "\n");
+ etiLog.log(info, "\n");
stats->frameCount = 0;
}
return size;
diff --git a/src/dabInputUdp.cpp b/src/dabInputUdp.cpp
index b128584..ee3ab32 100644
--- a/src/dabInputUdp.cpp
+++ b/src/dabInputUdp.cpp
@@ -71,7 +71,7 @@ int dabInputUdpOpen(void* args, const char* inputName)
address = strdup(inputName);
ptr = strchr(address, ':');
if (ptr == NULL) {
- etiLog.print(TcpLog::ERR,
+ etiLog.log(error,
"\"%s\" is an invalid format for udp address: "
"should be [address]:port - > aborting\n", address);
returnCode = -1;
@@ -79,25 +79,25 @@ int dabInputUdpOpen(void* args, const char* inputName)
*(ptr++) = 0;
port = strtol(ptr, (char **)NULL, 10);
if ((port == LONG_MIN) || (port == LONG_MAX)) {
- etiLog.print(TcpLog::ERR,
+ etiLog.log(error,
"can't convert port number in udp address %s\n",
address);
returnCode = -1;
}
if (port == 0) {
- etiLog.print(TcpLog::ERR, "can't use port number 0 in udp address\n");
+ etiLog.log(error, "can't use port number 0 in udp address\n");
returnCode = -1;
}
dabInputUdpData* input = (dabInputUdpData*)args;
if (input->socket->create(port) == -1) {
- etiLog.print(TcpLog::ERR, "can't set port %i on Udp input (%s: %s)\n",
+ etiLog.log(error, "can't set port %i on Udp input (%s: %s)\n",
port, inetErrDesc, inetErrMsg);
returnCode = -1;
}
if (*address != 0) {
if (input->socket->joinGroup(address) == -1) {
- etiLog.print(TcpLog::ERR,
+ etiLog.log(error,
"can't join multicast group %s (%s: %s)\n",
address, inetErrDesc, inetErrMsg);
returnCode = -1;
@@ -105,13 +105,13 @@ int dabInputUdpOpen(void* args, const char* inputName)
}
if (input->socket->setBlocking(false) == -1) {
- etiLog.print(TcpLog::ERR, "can't set Udp input socket in blocking mode "
+ etiLog.log(error, "can't set Udp input socket in blocking mode "
"(%s: %s)\n", inetErrDesc, inetErrMsg);
returnCode = -1;
}
free(address);
- etiLog.print(TcpLog::DBG, "check return code of create\n");
+ etiLog.log(debug, "check return code of create\n");
return returnCode;;
}
@@ -154,14 +154,14 @@ int dabInputUdpRead(dabInputOperations* ops, void* args, void* buffer, int size)
input->stats.frameRecords[input->stats.frameCount].curSize = nbBytes;
if (++stats->frameCount == NB_RECORDS) {
- etiLog.print(TcpLog::INFO, "Data subchannel usage: (%i)",
+ etiLog.log(info, "Data subchannel usage: (%i)",
stats->id);
for (int i = 0; i < stats->frameCount; ++i) {
- etiLog.print(TcpLog::INFO, " %i/%i",
+ etiLog.log(info, " %i/%i",
stats->frameRecords[i].curSize,
stats->frameRecords[i].maxSize);
}
- etiLog.print(TcpLog::INFO, "\n");
+ etiLog.log(info, "\n");
stats->frameCount = 0;
}
diff --git a/src/dabInputZmq.cpp b/src/dabInputZmq.cpp
index 92d3ab9..fc975bc 100644
--- a/src/dabInputZmq.cpp
+++ b/src/dabInputZmq.cpp
@@ -72,13 +72,13 @@ int dabInputZmqInit(void** args)
input->stats.id = dabInputFifoData::nb++;
input->zmq_context = zmq_ctx_new();
if (input->zmq_context == NULL) {
- etiLog.print(TcpLog::ERR, "Failed to initialise ZeroMQ context: %s\n", zmq_strerror(errno));
+ etiLog.log(error, "Failed to initialise ZeroMQ context: %s\n", zmq_strerror(errno));
return 1;
}
input->zmq_sock = zmq_socket(input->zmq_context, ZMQ_SUB);
if (input->zmq_sock == NULL) {
- etiLog.print(TcpLog::ERR, "Failed to initialise ZeroMQ socket: %s\n", zmq_strerror(errno));
+ etiLog.log(error, "Failed to initialise ZeroMQ socket: %s\n", zmq_strerror(errno));
return 1;
}
@@ -98,13 +98,13 @@ int dabInputZmqOpen(void* args, const char* inputUri)
int connect_error = zmq_bind(input->zmq_sock, uri.c_str());
if (connect_error < 0) {
- etiLog.print(TcpLog::ERR, "Failed to connect socket to uri '%s': %s\n", uri.c_str(), zmq_strerror(errno));
+ etiLog.log(error, "Failed to connect socket to uri '%s': %s\n", uri.c_str(), zmq_strerror(errno));
return 1;
}
connect_error = zmq_setsockopt(input->zmq_sock, ZMQ_SUBSCRIBE, NULL, 0);
if (connect_error < 0) {
- etiLog.print(TcpLog::ERR, "Failed to subscribe to zmq messages: %s\n", zmq_strerror(errno));
+ etiLog.log(error, "Failed to subscribe to zmq messages: %s\n", zmq_strerror(errno));
return 1;
}
@@ -130,14 +130,14 @@ int dabInputZmqReadFrame(dabInputOperations* ops, void* args, void* buffer, int
if (rc > 0)
input->prebuffering--;
if (input->prebuffering == 0)
- etiLog.print(TcpLog::NOTICE, "inputZMQ %s input pre-buffering complete\n",
+ etiLog.log(info, "inputZMQ %s input pre-buffering complete\n",
input->uri.c_str());
memset(buffer, 0, size);
return size;
}
if (input->frame_buffer.empty()) {
- etiLog.print(TcpLog::WARNING, "inputZMQ %s input empty, re-enabling pre-buffering\n",
+ etiLog.log(warn, "inputZMQ %s input empty, re-enabling pre-buffering\n",
input->uri.c_str());
// reset prebuffering
input->prebuffering = INPUT_ZMQ_PREBUFFERING;
@@ -161,14 +161,14 @@ int dabInputZmqReadFromSocket(dabInputZmqData* input, int framesize)
zmq_msg_t msg;
rc = zmq_msg_init(&msg);
if (rc == -1) {
- etiLog.print(TcpLog::ERR, "Failed to init zmq message: %s\n", zmq_strerror(errno));
+ etiLog.log(error, "Failed to init zmq message: %s\n", zmq_strerror(errno));
return 0;
}
int nBytes = zmq_msg_recv(&msg, input->zmq_sock, ZMQ_DONTWAIT);
if (nBytes == -1) {
if (errno != EAGAIN) {
- etiLog.print(TcpLog::ERR, "Failed to receive zmq message: %s\n", zmq_strerror(errno));
+ etiLog.log(error, "Failed to receive zmq message: %s\n", zmq_strerror(errno));
}
return 0;
}
@@ -178,7 +178,7 @@ int dabInputZmqReadFromSocket(dabInputZmqData* input, int framesize)
if (nBytes == 5*framesize) // five frames per superframe
{
if (input->frame_buffer.size() > INPUT_ZMQ_MAX_BUFFER_SIZE) {
- etiLog.print(TcpLog::WARNING, "inputZMQ %s input buffer full (%d), dropping frame !\n",
+ etiLog.log(warn, "inputZMQ %s input buffer full (%d), dropping frame !\n",
input->frame_buffer.size(), input->uri.c_str());
nBytes = 0;
@@ -198,7 +198,7 @@ int dabInputZmqReadFromSocket(dabInputZmqData* input, int framesize)
}
else
{
- etiLog.print(TcpLog::ERR, "ZMQ Wrong data size: recv'd %d, need %d \n",
+ etiLog.log(error, "ZMQ Wrong data size: recv'd %d, need %d \n",
nBytes, 5*framesize);
nBytes = 0;
}
diff --git a/src/dabOutput/dabOutput.cpp b/src/dabOutput/dabOutput.cpp
index 18da57e..7144e20 100644
--- a/src/dabOutput/dabOutput.cpp
+++ b/src/dabOutput/dabOutput.cpp
@@ -36,13 +36,13 @@ DabOutputFifo::open(const char* name)
this->type = ETI_FILE_TYPE_STREAMED;
break;
} else {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"File type '%s' is not supported.\n", value);
return -1;
}
}
else {
- etiLog.printHeader(TcpLog::WARNING, "Parameter '%s' unknown\n", key);
+ etiLog.log(warn, "Parameter '%s' unknown\n", key);
}
}
} while (nextPair != NULL);
@@ -86,7 +86,7 @@ int DabOutputFifo::write(void* buffer, int size)
goto FIFO_WRITE_ERROR;
break;
default:
- etiLog.printHeader(TcpLog::ERR, "File type is not supported.\n");
+ etiLog.log(error, "File type is not supported.\n");
return -1;
}
diff --git a/src/dabOutput/dabOutputFifo.cpp b/src/dabOutput/dabOutputFifo.cpp
index 1674cd8..ea0f538 100644
--- a/src/dabOutput/dabOutputFifo.cpp
+++ b/src/dabOutput/dabOutputFifo.cpp
@@ -60,7 +60,7 @@ int DabOutputFifo::Write(void* buffer, int size)
goto FIFO_WRITE_ERROR;
break;
default:
- etiLog.printHeader(TcpLog::ERR, "File type is not supported.\n");
+ etiLog.log(error, "File type is not supported.\n");
return -1;
}
diff --git a/src/dabOutput/dabOutputFile.cpp b/src/dabOutput/dabOutputFile.cpp
index 6512c5a..79dbeee 100644
--- a/src/dabOutput/dabOutputFile.cpp
+++ b/src/dabOutput/dabOutputFile.cpp
@@ -59,13 +59,13 @@ int DabOutputFile::Open(const char* filename)
this->type_ = ETI_FILE_TYPE_STREAMED;
break;
} else {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"File type '%s' is not supported.\n", value);
return -1;
}
}
else {
- etiLog.printHeader(TcpLog::WARNING, "Parameter '%s' unknown\n", key);
+ etiLog.log(warn, "Parameter '%s' unknown\n", key);
}
}
} while (nextPair != NULL);
@@ -113,7 +113,7 @@ int DabOutputFile::Write(void* buffer, int size)
if (write(this->file_, padding, 6144 - size) == -1) goto FILE_WRITE_ERROR;
break;
default:
- etiLog.printHeader(TcpLog::ERR, "File type is not supported.\n");
+ etiLog.log(error, "File type is not supported.\n");
return -1;
}
diff --git a/src/dabOutput/dabOutputRaw.cpp b/src/dabOutput/dabOutputRaw.cpp
index a9cd2a9..eb70712 100644
--- a/src/dabOutput/dabOutputRaw.cpp
+++ b/src/dabOutput/dabOutputRaw.cpp
@@ -78,7 +78,7 @@ const unsigned char revTable[] = {
int DabOutputRaw::Open(const char* filename)
{
if (filename == NULL) {
- etiLog.printHeader(TcpLog::ERR, "Socket name must be provided!\n");
+ etiLog.log(error, "Socket name must be provided!\n");
return -1;
}
@@ -87,7 +87,7 @@ int DabOutputRaw::Open(const char* filename)
this->socket_ = CreateFile(filename, GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL);
if (this->socket_ == INVALID_HANDLE_VALUE) {
- etiLog.printHeader(TcpLog::ERR, "Can't open raw device '%s': %i\n",
+ etiLog.log(error, "Can't open raw device '%s': %i\n",
filename, GetLastError());
return -1;
}
@@ -97,7 +97,7 @@ int DabOutputRaw::Open(const char* filename)
FS_TE1_CONFIG config;
if (!DeviceIoControl(this->socket_, IoctlCodeFarSyncGetTE1Config, NULL, 0,
&config, sizeof(config), &result, NULL)) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Can't get raw device '%s' config: %i\n",
filename, GetLastError());
return -1;
@@ -121,7 +121,7 @@ int DabOutputRaw::Open(const char* filename)
config.idleCode = 0xff;
if (!DeviceIoControl(this->socket_, IoctlCodeFarSyncSetTE1Config,
&config, sizeof(config), NULL, 0, &result, NULL)) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Can't set raw device '%s' config: %i\n",
filename, GetLastError());
return -1;
@@ -130,14 +130,14 @@ int DabOutputRaw::Open(const char* filename)
// Starting device
if (!DeviceIoControl(this->socket_, IoctlCodeFarSyncQuickStart, NULL, 0,
NULL, 0, &result, NULL)) {
- etiLog.printHeader(TcpLog::ERR, "Can't start raw device '%s': %i\n",
+ etiLog.log(error, "Can't start raw device '%s': %i\n",
filename, GetLastError());
return -1;
}
#else
this->socket_ = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP);
if (this->socket_ == -1) {
- etiLog.printHeader(TcpLog::ERR, "Are you logged as root?\n");
+ etiLog.log(error, "Are you logged as root?\n");
perror(filename);
return -1;
}
@@ -152,19 +152,19 @@ int DabOutputRaw::Open(const char* filename)
memset(&info, 0, sizeof(info));
ifr.ifr_data = (char*)&info;
if (ioctl(this->socket_, FSTGETCONF, &ifr) == -1) {
- etiLog.printHeader(TcpLog::DBG, "Cyclades card identified.\n");
+ etiLog.log(debug, "Cyclades card identified.\n");
this->isCyclades_ = true;
// Set the interface MTU if needed
if (ioctl(this->socket_, SIOCGIFMTU, &ifr) == -1) {
- etiLog.printHeader(TcpLog::ERR, "Can't get raw device MTU!\n");
+ etiLog.log(error, "Can't get raw device MTU!\n");
perror(filename);
return -1;
} else {
if (ifr.ifr_mtu != 6143) {
ifr.ifr_mtu = 6143;
if (ioctl(this->socket_, SIOCSIFMTU, &ifr) == -1) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Can't Cyclades device MTU!\n");
perror(filename);
return -1;
@@ -172,7 +172,7 @@ int DabOutputRaw::Open(const char* filename)
}
}
} else {
- etiLog.printHeader(TcpLog::DBG, "Farsync card identified.\n");
+ etiLog.log(debug, "Farsync card identified.\n");
this->isCyclades_ = false;
info.lineInterface = E1;
@@ -196,38 +196,38 @@ int DabOutputRaw::Open(const char* filename)
info.valid = FSTVAL_ALL;
// Setting configuration
- etiLog.printHeader(TcpLog::DBG, "Set configuration.\n");
+ etiLog.log(debug, "Set configuration.\n");
ifr.ifr_data = (char*)&info;
if (ioctl(this->socket_, FSTSETCONF, &ifr) == -1) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Can't set Farsync configurationi!\n");
perror(filename);
return -1;
}
// Disabling notify
- etiLog.printHeader(TcpLog::DBG, "Disable notify.\n");
+ etiLog.log(debug, "Disable notify.\n");
int notify = 0;
ifr.ifr_data = (char*)&notify;
if (ioctl(this->socket_, FSTSNOTIFY, &ifr) == -1) {
- etiLog.printHeader(TcpLog::ERR, "Can't disable Farsync notify!\n");
+ etiLog.log(error, "Can't disable Farsync notify!\n");
perror(filename);
return -1;
}
// Apply the new configuration
// Set the interface down if needed
- etiLog.printHeader(TcpLog::DBG, "Get flags.\n");
+ etiLog.log(debug, "Get flags.\n");
if (ioctl(this->socket_, SIOCGIFFLAGS, &ifr) == -1) {
- etiLog.printHeader(TcpLog::ERR, "Can't get Farsync flags!\n");
+ etiLog.log(error, "Can't get Farsync flags!\n");
perror(filename);
return -1;
} else {
if (ifr.ifr_flags & IFF_UP) {
- etiLog.printHeader(TcpLog::DBG, "Set flags.\n");
+ etiLog.log(debug, "Set flags.\n");
ifr.ifr_flags &= ~IFF_UP;
if (ioctl(this->socket_, SIOCSIFFLAGS, &ifr) == -1) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"Can't turn down Farsync device!\n");
perror(filename);
return -1;
@@ -236,17 +236,17 @@ int DabOutputRaw::Open(const char* filename)
}
// Set the interface MTU if needed
- etiLog.printHeader(TcpLog::DBG, "Get MTU.\n");
+ etiLog.log(debug, "Get MTU.\n");
if (ioctl(this->socket_, SIOCGIFMTU, &ifr) == -1) {
- etiLog.printHeader(TcpLog::ERR, "Can't get Farsync MTU!\n");
+ etiLog.log(error, "Can't get Farsync MTU!\n");
perror(filename);
return -1;
} else {
if (ifr.ifr_mtu != 6144) {
- etiLog.printHeader(TcpLog::DBG, "Set MTU.\n");
+ etiLog.log(debug, "Set MTU.\n");
ifr.ifr_mtu = 6144;
if (ioctl(this->socket_, SIOCSIFMTU, &ifr) == -1) {
- etiLog.printHeader(TcpLog::ERR, "Can't set Farsync MTU!\n");
+ etiLog.log(error, "Can't set Farsync MTU!\n");
perror(filename);
return -1;
}
@@ -255,17 +255,17 @@ int DabOutputRaw::Open(const char* filename)
}
// Set the interface up if needed
- etiLog.printHeader(TcpLog::DBG, "Get flags.\n");
+ etiLog.log(debug, "Get flags.\n");
if (ioctl(this->socket_, SIOCGIFFLAGS, &ifr) == -1) {
- etiLog.printHeader(TcpLog::ERR, "Can't get raw device flags!\n");
+ etiLog.log(error, "Can't get raw device flags!\n");
perror(filename);
return -1;
} else {
if (!(ifr.ifr_flags & IFF_UP)) {
ifr.ifr_flags |= IFF_UP;
- etiLog.printHeader(TcpLog::DBG, "Set flags.\n");
+ etiLog.log(debug, "Set flags.\n");
if (ioctl(this->socket_, SIOCSIFFLAGS, &ifr) == -1) {
- etiLog.printHeader(TcpLog::ERR, "Can't turn up raw device!\n");
+ etiLog.log(error, "Can't turn up raw device!\n");
perror(filename);
return -1;
}
@@ -279,13 +279,13 @@ int DabOutputRaw::Open(const char* filename)
////////////////////
if ((this->socket_ = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_CUST))) == -1) {
- etiLog.printHeader(TcpLog::ERR, "Are you logged as root?\n");
+ etiLog.log(error, "Are you logged as root?\n");
perror(filename);
return -1;
}
// ioctl to read the interface number
- etiLog.printHeader(TcpLog::DBG, "Get index.\n");
+ etiLog.log(debug, "Get index.\n");
memset(&ifr, 0, sizeof(struct ifreq));
strncpy(ifr.ifr_name, filename, sizeof(ifr.ifr_name));
if (ioctl(this->socket_, SIOCGIFINDEX, (char *) &ifr) == -1) {
@@ -294,13 +294,13 @@ int DabOutputRaw::Open(const char* filename)
}
// Bind to the interface name
- etiLog.printHeader(TcpLog::DBG, "Bind interface.\n");
+ etiLog.log(debug, "Bind interface.\n");
memset(&saddr, 0, sizeof(struct sockaddr_ll));
saddr.sll_family = AF_PACKET;
saddr.sll_protocol = ARPHRD_RAWHDLC;
saddr.sll_ifindex = ifr.ifr_ifindex;
if (bind(this->socket_, (struct sockaddr *) &saddr, sizeof(saddr)) == -1) {
- etiLog.printHeader(TcpLog::ERR, "Can't bind raw device!\n");
+ etiLog.log(error, "Can't bind raw device!\n");
perror(filename);
return -1;
}
diff --git a/src/dabOutput/dabOutputTcp.cpp b/src/dabOutput/dabOutputTcp.cpp
index c59eacb..427018e 100644
--- a/src/dabOutput/dabOutputTcp.cpp
+++ b/src/dabOutput/dabOutputTcp.cpp
@@ -52,13 +52,13 @@ void* tcpThread(void* param)
DabOutputTcp* tcp = (DabOutputTcp*)param;
while ((client = tcp->server->accept()) != NULL) {
- etiLog.print(TcpLog::INFO, "TCP server got a new client.\n");
+ etiLog.log(info, "TCP server got a new client.\n");
if (tcp->client != NULL) {
delete tcp->client;
}
tcp->client = client;
}
- etiLog.print(TcpLog::ERR, "TCP thread can't accept new client (%s)\n",
+ etiLog.log(error, "TCP thread can't accept new client (%s)\n",
inetErrDesc, inetErrMsg);
return NULL;
@@ -72,7 +72,7 @@ int DabOutputTcp::Open(const char* name)
long port;
address = strchr((char*)hostport, ':');
if (address == NULL) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"\"%s\" is an invalid format for tcp address: "
"should be [address]:port - > aborting\n",
hostport);
@@ -84,26 +84,26 @@ int DabOutputTcp::Open(const char* name)
port = strtol(address, (char **)NULL, 10);
if ((port == LONG_MIN) || (port == LONG_MAX)) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"can't convert port number in tcp address %s\n", address);
goto tcp_open_fail;
}
if (port == 0) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"can't use port number 0 in tcp address\n");
goto tcp_open_fail;
}
address = hostport;
if (strlen(address) > 0) {
if (this->server->create(port, address) == -1) {
- etiLog.printHeader(TcpLog::ERR, "Can't create Tcp server on %s:%i "
+ etiLog.log(error, "Can't create Tcp server on %s:%i "
"(%s: %s) -> aborting\n",
address, port, inetErrDesc, inetErrMsg);
goto tcp_open_fail;
}
} else {
if (this->server->create(port) == -1) {
- etiLog.printHeader(TcpLog::ERR, "Can't create Tcp server on :%i "
+ etiLog.log(error, "Can't create Tcp server on :%i "
"(%s: %s) -> aborting\n",
port, inetErrDesc, inetErrMsg);
goto tcp_open_fail;
@@ -114,7 +114,7 @@ int DabOutputTcp::Open(const char* name)
// this->packet_->getAddress().getPort());
if (this->server->listen() == -1) {
- etiLog.printHeader(TcpLog::ERR, "Can't listen on Tcp socket (%s: %s)\n",
+ etiLog.log(error, "Can't listen on Tcp socket (%s: %s)\n",
inetErrDesc, inetErrMsg);
goto tcp_open_fail;
}
@@ -149,7 +149,7 @@ int DabOutputTcp::Write(void* buffer, int size)
}
}
else {
- etiLog.print(TcpLog::INFO, "TCP server client disconnected.\n");
+ etiLog.log(info, "TCP server client disconnected.\n");
delete this->client;
this->client = NULL;
}
diff --git a/src/dabOutput/dabOutputUdp.cpp b/src/dabOutput/dabOutputUdp.cpp
index 684cd50..459120f 100644
--- a/src/dabOutput/dabOutputUdp.cpp
+++ b/src/dabOutput/dabOutputUdp.cpp
@@ -52,7 +52,7 @@ int DabOutputUdp::Open(const char* name)
long port;
address = strchr(hostport, ':');
if (address == NULL) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"\"%s\" is an invalid format for UDP address: "
"should be [address]:port - > aborting\n",
hostport);
@@ -64,19 +64,19 @@ int DabOutputUdp::Open(const char* name)
port = strtol(address, (char **)NULL, 10);
if ((port == LONG_MIN) || (port == LONG_MAX)) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"can't convert port number in UDP address %s\n", address);
goto udp_open_fail;
}
if (port == 0) {
- etiLog.printHeader(TcpLog::ERR,
+ etiLog.log(error,
"can't use port number 0 in UDP address\n");
goto udp_open_fail;
}
address = hostport;
if (strlen(address) > 0) {
if (this->packet_->getAddress().setAddress(address) == -1) {
- etiLog.printHeader(TcpLog::ERR, "can't set address %s (%s: %s) "
+ etiLog.log(error, "can't set address %s (%s: %s) "
"-> aborting\n", address, inetErrDesc, inetErrMsg);
goto udp_open_fail;
}
@@ -84,7 +84,7 @@ int DabOutputUdp::Open(const char* name)
this->packet_->getAddress().setPort(port);
if (this->socket_->create() == -1) {
- etiLog.printHeader(TcpLog::ERR, "can't create UDP socket (%s: %s) "
+ etiLog.log(error, "can't create UDP socket (%s: %s) "
"-> aborting\n)", inetErrDesc, inetErrMsg);
goto udp_open_fail;
}
diff --git a/src/utils.cpp b/src/utils.cpp
index 64a9bd1..09a3eb6 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -46,76 +46,76 @@ time_t getDabTime()
void header_message()
{
- etiLog.printHeader(TcpLog::INFO,
+ etiLog.log(info,
"Welcome to %s %s%s, compiled at %s, %s\n\n",
PACKAGE_NAME, PACKAGE_VERSION, GITVERSION, __DATE__, __TIME__);
- etiLog.printHeader(TcpLog::INFO,
+ etiLog.log(info,
"Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012\n"
"Her Majesty the Queen in Right of Canada,\n"
"(Communications Research Centre Canada) All rights reserved.\n\n"
"Copyright (C) 2013,2014\nMatthias P. Braendli, http://mpb.li\n\n");
- etiLog.printHeader(TcpLog::INFO, "Input URLs supported:");
+ etiLog.log(info, "Input URLs supported:");
#if defined(HAVE_INPUT_PRBS)
- etiLog.printHeader(TcpLog::INFO, " prbs");
+ etiLog.log(info, " prbs");
#endif
#if defined(HAVE_INPUT_TEST)
- etiLog.printHeader(TcpLog::INFO, " test");
+ etiLog.log(info, " test");
#endif
#if defined(HAVE_INPUT_SLIP)
- etiLog.printHeader(TcpLog::INFO, " slip");
+ etiLog.log(info, " slip");
#endif
#if defined(HAVE_INPUT_UDP)
- etiLog.printHeader(TcpLog::INFO, " udp");
+ etiLog.log(info, " udp");
#endif
#if defined(HAVE_INPUT_FIFO)
- etiLog.printHeader(TcpLog::INFO, " fifo");
+ etiLog.log(info, " fifo");
#endif
#if defined(HAVE_INPUT_FILE)
- etiLog.printHeader(TcpLog::INFO, " file");
+ etiLog.log(info, " file");
#endif
- etiLog.printHeader(TcpLog::INFO, "\n");
+ etiLog.log(info, "\n");
- etiLog.printHeader(TcpLog::INFO, "Inputs format supported:");
+ etiLog.log(info, "Inputs format supported:");
#if defined(HAVE_FORMAT_RAW)
- etiLog.printHeader(TcpLog::INFO, " raw");
+ etiLog.log(info, " raw");
#endif
#if defined(HAVE_FORMAT_BRIDGE)
- etiLog.printHeader(TcpLog::INFO, " bridge");
+ etiLog.log(info, " bridge");
#endif
#if defined(HAVE_FORMAT_MPEG)
- etiLog.printHeader(TcpLog::INFO, " mpeg");
+ etiLog.log(info, " mpeg");
#endif
#if defined(HAVE_FORMAT_PACKET)
- etiLog.printHeader(TcpLog::INFO, " packet");
+ etiLog.log(info, " packet");
#endif
#if defined(HAVE_FORMAT_DMB)
- etiLog.printHeader(TcpLog::INFO, " dmb");
+ etiLog.log(info, " dmb");
#endif
#if defined(HAVE_FORMAT_EPM)
- etiLog.printHeader(TcpLog::INFO, " epm");
+ etiLog.log(info, " epm");
#endif
- etiLog.printHeader(TcpLog::INFO, "\n");
+ etiLog.log(info, "\n");
- etiLog.printHeader(TcpLog::INFO, "Output URLs supported:");
+ etiLog.log(info, "Output URLs supported:");
#if defined(HAVE_OUTPUT_FILE)
- etiLog.printHeader(TcpLog::INFO, " file");
+ etiLog.log(info, " file");
#endif
#if defined(HAVE_OUTPUT_FIFO)
- etiLog.printHeader(TcpLog::INFO, " fifo");
+ etiLog.log(info, " fifo");
#endif
#if defined(HAVE_OUTPUT_UDP)
- etiLog.printHeader(TcpLog::INFO, " udp");
+ etiLog.log(info, " udp");
#endif
#if defined(HAVE_OUTPUT_TCP)
- etiLog.printHeader(TcpLog::INFO, " tcp");
+ etiLog.log(info, " tcp");
#endif
#if defined(HAVE_OUTPUT_RAW)
- etiLog.printHeader(TcpLog::INFO, " raw");
+ etiLog.log(info, " raw");
#endif
#if defined(HAVE_OUTPUT_SIMUL)
- etiLog.printHeader(TcpLog::INFO, " simul");
+ etiLog.log(info, " simul");
#endif
- etiLog.printHeader(TcpLog::INFO, "\n\n");
+ etiLog.log(info, "\n\n");
}
@@ -217,7 +217,7 @@ void printUsage(char *name, FILE* out)
fprintf(out, " -h : get this help\n");
fprintf(out, " -m : DAB mode (default: 2)\n");
fprintf(out, " -n nbFrames : number of frames to produce\n");
- fprintf(out, " -o : turn on TCP log on port 12222\n");
+ fprintf(out, " -o : enable logging to syslog\n");
fprintf(out, " -r : throttle the output rate to one ETI frame every 24ms\n");
fprintf(out, " -V : print version information and "
"exit\n");
@@ -280,10 +280,10 @@ void printOutputs(vector<dabOutput*>& outputs)
int index = 0;
for (output = outputs.begin(); output != outputs.end(); ++output) {
- etiLog.printHeader(TcpLog::INFO, "Output %i\n", index);
- etiLog.printHeader(TcpLog::INFO, " protocol: %s\n",
+ etiLog.log(info, "Output %i\n", index);
+ etiLog.log(info, " protocol: %s\n",
(*output)->outputProto.c_str());
- etiLog.printHeader(TcpLog::INFO, " name: %s\n",
+ etiLog.log(info, " name: %s\n",
(*output)->outputName.c_str());
++index;
}
@@ -299,20 +299,20 @@ void printServices(vector<dabService*>& services)
memcpy(label, (*current)->label.text, 16);
label[16] = 0;
- etiLog.printHeader(TcpLog::INFO, "Service %i\n", index);
- etiLog.printHeader(TcpLog::INFO, " label: %s\n", label);
- etiLog.printHeader(TcpLog::INFO, " short label: ");
+ etiLog.log(info, "Service %i\n", index);
+ etiLog.log(info, " label: %s\n", label);
+ etiLog.log(info, " short label: ");
for (int i = 0; i < 32; ++i) {
if ((*current)->label.flag & 0x8000 >> i) {
- etiLog.printHeader(TcpLog::INFO, "%c", (*current)->label.text[i]);
+ etiLog.log(info, "%c", (*current)->label.text[i]);
}
}
- etiLog.printHeader(TcpLog::INFO, " (0x%x)\n", (*current)->label.flag);
- etiLog.printHeader(TcpLog::INFO, " id: 0x%lx (%lu)\n",
+ etiLog.log(info, " (0x%x)\n", (*current)->label.flag);
+ etiLog.log(info, " id: 0x%lx (%lu)\n",
(*current)->id, (*current)->id);
- etiLog.printHeader(TcpLog::INFO, " pty: 0x%x (%u)\n",
+ etiLog.log(info, " pty: 0x%x (%u)\n",
(*current)->pty, (*current)->pty);
- etiLog.printHeader(TcpLog::INFO, " language: 0x%x (%u)\n",
+ etiLog.log(info, " language: 0x%x (%u)\n",
(*current)->language, (*current)->language);
++index;
}
@@ -324,7 +324,7 @@ void printComponents(vector<dabComponent*>& components)
unsigned int index = 0;
for (current = components.begin(); current != components.end(); ++current) {
- etiLog.printHeader(TcpLog::INFO, "Component %i\n", index);
+ etiLog.log(info, "Component %i\n", index);
printComponent(*current);
++index;
}
@@ -339,28 +339,28 @@ void printComponent(dabComponent* component)
sprintf(label, "<none>");
}
- etiLog.printHeader(TcpLog::INFO, " service id: %i\n",
+ etiLog.log(info, " service id: %i\n",
component->serviceId);
- etiLog.printHeader(TcpLog::INFO, " subchannel id: %i\n",
+ etiLog.log(info, " subchannel id: %i\n",
component->subchId);
- etiLog.printHeader(TcpLog::INFO, " label: %s\n",
+ etiLog.log(info, " label: %s\n",
label);
- etiLog.printHeader(TcpLog::INFO, " short label: ");
+ etiLog.log(info, " short label: ");
for (int i = 0; i < 32; ++i) {
if (component->label.flag & 0x8000 >> i) {
- etiLog.printHeader(TcpLog::INFO, "%c", component->label.text[i]);
+ etiLog.log(info, "%c", component->label.text[i]);
}
}
- etiLog.printHeader(TcpLog::INFO, " (0x%x)\n", component->label.flag);
- etiLog.printHeader(TcpLog::INFO, " service component type: 0x%x (%u)\n",
+ etiLog.log(info, " (0x%x)\n", component->label.flag);
+ etiLog.log(info, " service component type: 0x%x (%u)\n",
component->type, component->type);
- etiLog.printHeader(TcpLog::INFO, " (packet) id: %u\n",
+ etiLog.log(info, " (packet) id: %u\n",
component->packet.id);
- etiLog.printHeader(TcpLog::INFO, " (packet) address: %u\n",
+ etiLog.log(info, " (packet) address: %u\n",
component->packet.address);
- etiLog.printHeader(TcpLog::INFO, " (packet) app type: %u\n",
+ etiLog.log(info, " (packet) app type: %u\n",
component->packet.appType);
- etiLog.printHeader(TcpLog::INFO, " (packet) datagroup: %u\n",
+ etiLog.log(info, " (packet) datagroup: %u\n",
component->packet.datagroup);
}
@@ -372,57 +372,57 @@ void printSubchannels(vector<dabSubchannel*>& subchannels)
for (subchannel = subchannels.begin(); subchannel != subchannels.end();
++subchannel) {
dabProtection* protection = &(*subchannel)->protection;
- etiLog.printHeader(TcpLog::INFO, "Subchannel %i\n", index);
- etiLog.printHeader(TcpLog::INFO, " input\n");
- etiLog.printHeader(TcpLog::INFO, " protocol: %s\n",
+ etiLog.log(info, "Subchannel %i\n", index);
+ etiLog.log(info, " input\n");
+ etiLog.log(info, " protocol: %s\n",
(*subchannel)->inputProto);
- etiLog.printHeader(TcpLog::INFO, " name: %s\n",
+ etiLog.log(info, " name: %s\n",
(*subchannel)->inputName);
- etiLog.printHeader(TcpLog::INFO, " type: ");
+ etiLog.log(info, " type: ");
switch ((*subchannel)->type) {
case 0:
- etiLog.printHeader(TcpLog::INFO, "audio\n");
+ etiLog.log(info, "audio\n");
break;
case 1:
- etiLog.printHeader(TcpLog::INFO, "data\n");
+ etiLog.log(info, "data\n");
break;
case 2:
- etiLog.printHeader(TcpLog::INFO, "fidc\n");
+ etiLog.log(info, "fidc\n");
break;
case 3:
- etiLog.printHeader(TcpLog::INFO, "packet\n");
+ etiLog.log(info, "packet\n");
break;
default:
- etiLog.printHeader(TcpLog::INFO, "Unknown data type "
+ etiLog.log(info, "Unknown data type "
"(service->type)\n");
break;
}
- etiLog.printHeader(TcpLog::INFO, " id: %i\n",
+ etiLog.log(info, " id: %i\n",
(*subchannel)->id);
- etiLog.printHeader(TcpLog::INFO, " bitrate: %i\n",
+ etiLog.log(info, " bitrate: %i\n",
(*subchannel)->bitrate);
- etiLog.printHeader(TcpLog::INFO, " protection: ");
+ etiLog.log(info, " protection: ");
if (protection->form == 0) {
- etiLog.printHeader(TcpLog::INFO, "UEP %i\n", protection->level + 1);
+ etiLog.log(info, "UEP %i\n", protection->level + 1);
} else {
- etiLog.printHeader(TcpLog::INFO, "EEP %i-%c\n",
+ etiLog.log(info, "EEP %i-%c\n",
protection->level + 1,
protection->longForm.option == 0 ? 'A' : 'B');
}
if (protection->form == 0) {
- etiLog.printHeader(TcpLog::INFO,
+ etiLog.log(info,
" form: short\n switch: %i\n index: %i\n",
protection->shortForm.tableSwitch,
protection->shortForm.tableIndex);
} else {
- etiLog.printHeader(TcpLog::INFO,
+ etiLog.log(info,
" form: long\n option: %i\n level: %i\n",
protection->longForm.option,
(*subchannel)->protection.level);
}
- etiLog.printHeader(TcpLog::INFO, " SAD: %i\n",
+ etiLog.log(info, " SAD: %i\n",
(*subchannel)->startAddress);
- etiLog.printHeader(TcpLog::INFO, " size (CU): %i\n",
+ etiLog.log(info, " size (CU): %i\n",
getSizeCu(*subchannel));
++index;
}
@@ -434,20 +434,20 @@ void printEnsemble(dabEnsemble* ensemble)
memcpy(label, ensemble->label.text, 16);
label[16] = 0;
- etiLog.printHeader(TcpLog::INFO, "Ensemble\n");
- etiLog.printHeader(TcpLog::INFO, " id: 0x%lx (%lu)\n",
+ etiLog.log(info, "Ensemble\n");
+ etiLog.log(info, " id: 0x%lx (%lu)\n",
ensemble->id, ensemble->id);
- etiLog.printHeader(TcpLog::INFO, " ecc: 0x%x (%u)\n",
+ etiLog.log(info, " ecc: 0x%x (%u)\n",
ensemble->ecc, ensemble->ecc);
- etiLog.printHeader(TcpLog::INFO, " label: %s\n", label);
- etiLog.printHeader(TcpLog::INFO, " short label: ");
+ etiLog.log(info, " label: %s\n", label);
+ etiLog.log(info, " short label: ");
for (int i = 0; i < 32; ++i) {
if (ensemble->label.flag & 0x8000 >> i) {
- etiLog.printHeader(TcpLog::INFO, "%c", ensemble->label.text[i]);
+ etiLog.log(info, "%c", ensemble->label.text[i]);
}
}
- etiLog.printHeader(TcpLog::INFO, " (0x%x)\n", ensemble->label.flag);
- etiLog.printHeader(TcpLog::INFO, " mode: %u\n", ensemble->mode);
+ etiLog.log(info, " (0x%x)\n", ensemble->label.flag);
+ etiLog.log(info, " mode: %u\n", ensemble->mode);
}