Skip to content

Commit

Permalink
cleanup INFO level logging
Browse files Browse the repository at this point in the history
  • Loading branch information
furmur committed Aug 30, 2024
1 parent b040721 commit 0355485
Show file tree
Hide file tree
Showing 19 changed files with 56 additions and 164 deletions.
6 changes: 3 additions & 3 deletions apps/jsonrpc/RpcServerLoop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ void JsonRPCServerLoop::run()

threadpool.addThreads(JsonRPCServerModule::threads - 1);

INFO("running server loop; listening on %s:%d",
DBG("running server loop; listening on %s:%d",
JsonRPCServerModule::host.c_str(),
JsonRPCServerModule::port);

Expand All @@ -479,15 +479,15 @@ void JsonRPCServerLoop::run()
ev_async_init (&async_w, async_cb);
ev_async_start (EV_A_ &async_w);

INFO("running event loop");
DBG("running event loop");

setEventNotificationSink(this);
AmEventDispatcher::instance()->addEventQueue(JSONRPC_QUEUE_NAME,this);

ev_loop (loop, 0);

AmEventDispatcher::instance()->delEventQueue(JSONRPC_QUEUE_NAME);
INFO("event loop finished");
DBG("event loop finished");
threadpool.cleanup();
close(listen_fd);
listen_fd = 0;
Expand Down
2 changes: 1 addition & 1 deletion apps/jsonrpc/RpcServerThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void RpcServerThread::run() {
}

void RpcServerThread::on_stop() {
INFO("TODO: stop server thread");
DBG("stop server thread");
ev_pending.set(true);
is_stop.set(true);
join();
Expand Down
2 changes: 1 addition & 1 deletion core/AmEventQueueProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void EventQueueWorker::run()

void EventQueueWorker::on_stop()
{
INFO("requesting worker to stop.");
DBG("requesting worker to stop.");
stop_requested.set(true);
runcond.set(true);
join();
Expand Down
72 changes: 1 addition & 71 deletions core/AmLcConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "RtspClient.h"

#include <fstream>
#include <iostream>

#define SECTION_SIGIF_NAME "signaling-interfaces"
#define SECTION_MEDIAIF_NAME "media-interfaces"
Expand Down Expand Up @@ -2003,77 +2004,6 @@ int AmLcConfig::finalizeIpConfig(ConfigContainer* config)
return 0;
}

void AmLcConfig::dump_Ifs(ConfigContainer* config)
{
INFO("Signaling interfaces:");
for(unsigned int i=0; i<config->sip_ifs.size(); i++) {
SIP_interface& it_ref = config->sip_ifs[i];
INFO("\t(%i) name='%s'", i,it_ref.name.c_str());
std::vector<SIP_info*>::iterator it = it_ref.proto_info.begin();
for(; it != it_ref.proto_info.end(); it++) {
if((*it)->type == SIP_info::TCP) {
SIP_TCP_info* info = SIP_TCP_info::toSIP_TCP(*it);
INFO("\t\tTCP %u/%u",
info->tcp_connect_timeout,
info->tcp_idle_timeout);
} else if((*it)->type == SIP_info::TLS) {
SIP_TLS_info* info = SIP_TLS_info::toSIP_TLS(*it);
INFO("\t\tTLS %u/%u",
info->tcp_connect_timeout,
info->tcp_idle_timeout);

info->client_settings.dump("client");
info->server_settings.dump("server");
} else {
INFO("\t\tUDP");
}
INFO("\t\tLocalIP='%s'"
";local_port='%u'"
";PublicIP='%s'; DSCP=%u",
(*it)->local_ip.c_str(),
(*it)->local_port,
(*it)->public_ip.c_str(),
(*it)->dscp);
}
}

INFO("Signaling address map:");
for(std::map<std::string,unsigned short>::iterator it = config->local_sip_ip2if.begin();
it != config->local_sip_ip2if.end(); ++it) {
if(config->sip_ifs[it->second].name.empty()) {
INFO("\t%s -> default",it->first.c_str());
}
else {
INFO("\t%s -> %s",it->first.c_str(),
config->sip_ifs[it->second].name.c_str());
}
}

INFO("Media interfaces:");
for(unsigned int i=0; i<config->media_ifs.size(); i++) {

MEDIA_interface& it_ref = config->media_ifs[i];
INFO("\t(%i) name='%s'", i,it_ref.name.c_str());
std::vector<MEDIA_info*>::iterator it = it_ref.proto_info.begin();
for(; it != it_ref.proto_info.end(); it++) {
if((*it)->mtype == MEDIA_info::RTP) {
INFO("\t\tRTP");
} else {
INFO("\t\tRTSP");
}
INFO("\t\tLocalIP='%s'"
";Ports=[%u;%u]"
";MediaCapacity=%u"
";PublicIP='%s'; DSCP=%u",
(*it)->local_ip.c_str(),
(*it)->low_port,(*it)->high_port,
((*it)->high_port - (*it)->low_port+1)/2,
(*it)->public_ip.c_str(),
(*it)->dscp);
}
}
}

void AmLcConfig::fillMissingLocalSIPIPfromSysIntfs(ConfigContainer* config)
{
// add addresses from SysIntfList, if not present
Expand Down
1 change: 0 additions & 1 deletion core/AmLcConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ class AmLcConfig

int readConfiguration(ConfigContainer* config = &AmConfig);
int finalizeIpConfig(ConfigContainer* config = &AmConfig);
void dump_Ifs(ConfigContainer* config = &AmConfig);
std::string fixIface2IP(const std::string& dev_name, bool v6_for_sip, ConfigContainer* config = &AmConfig);

int setLogLevel(const std::string& level, bool apply = true);
Expand Down
4 changes: 2 additions & 2 deletions core/AmMediaProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ AmMediaProcessor::AmMediaProcessor()

AmMediaProcessor::~AmMediaProcessor()
{
INFO("Media processor has been recycled.");
DBG("Media processor has been recycled.");
}

void AmMediaProcessor::init()
Expand Down Expand Up @@ -372,7 +372,7 @@ AmMediaProcessorThread::~AmMediaProcessorThread()

void AmMediaProcessorThread::on_stop()
{
INFO("requesting media processor to stop.");
DBG("requesting media processor to stop.");
stop_requested = true;
}

Expand Down
4 changes: 2 additions & 2 deletions core/AmRtpReceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,12 @@ AmRtpReceiverThread::AmRtpReceiverThread()

AmRtpReceiverThread::~AmRtpReceiverThread()
{
INFO("RTP receiver has been recycled.");
DBG("RTP receiver has been recycled.");
}

void AmRtpReceiverThread::on_stop()
{
INFO("requesting RTP receiver to stop.");
DBG("requesting RTP receiver to stop.");
stop_event.fire();
}

Expand Down
2 changes: 1 addition & 1 deletion core/AmSessionContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ void AmSessionContainer::on_stop()
usleep(10000);

if (!AmEventDispatcher::instance()->empty()) {
WARN("Not all calls cleanly ended!");
WARN("Not all sessions cleanly ended!");
}

DBG("cleaning sessions...");
Expand Down
2 changes: 1 addition & 1 deletion core/AmSessionProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ void AmSessionProcessorThread::run()
}

void AmSessionProcessorThread::on_stop() {
INFO("requesting session to stop.");
DBG("requesting session to stop.");
stop_requested.set(true);
runcond.set(true);
}
Expand Down
4 changes: 2 additions & 2 deletions core/AmThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ void * AmThread::_start(void * _t)
_self_tid = static_cast<pthread_t>(GET_TID());
unsigned long _tid = _this->_pid;

INFO("Thread %lu is starting", static_cast<unsigned long>(_tid));
DBG("Thread %lu is starting", static_cast<unsigned long>(_tid));

_this->run();

char thread_name[16];
pthread_getname_np(_tid, thread_name,16);
INFO("Thread %s %lu is ending",
DBG("Thread %s %lu is ending",
thread_name, static_cast<unsigned long>(_tid));

_this->_stopped.set(true);
Expand Down
2 changes: 1 addition & 1 deletion core/RtspClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ int RtspClient::init()

init_connections();

INFO("RtspClient initialized");
DBG("RtspClient initialized");

return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions core/ampi/MonitoringAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,11 @@
#define _MONITORING_INIT \
AmDynInvokeFactory* monitoring_fact= AmPlugIn::instance()->getFactory4Di("monitoring"); \
if(!monitoring_fact) { \
INFO("monitoring module not loaded, monitoring disabled"); \
DBG("monitoring module not loaded, monitoring disabled"); \
} else { \
monitoring_di = monitoring_fact->getInstance(); \
assert(monitoring_di); \
INFO("monitoring enabled"); \
DBG("monitoring enabled"); \
} \

#else
Expand Down
66 changes: 28 additions & 38 deletions core/sems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ static void signal_handler(int sig)
if(!is_shutting_down.get()) {
is_shutting_down.set(true);

INFO("Stopping SIP stack after signal");
DBG("Stopping SIP stack after signal");
sip_ctrl.stop();
}
} else {
Expand Down Expand Up @@ -422,7 +422,7 @@ int set_fd_limit()
return -1;
}

INFO("Open FDs limit has been raised to %u",
DBG("Open FDs limit has been raised to %u",
(unsigned int)rlim.rlim_cur);

return 0;
Expand Down Expand Up @@ -542,23 +542,15 @@ int main(int argc, char* argv[])
if(AmLcConfig::instance().finalizeIpConfig() < 0)
goto error;

printf("Configuration:\n"
#ifdef _DEBUG
" syslog log level: %s (%i)\n"
" log to stderr: %s\n"
#endif
" configuration file: %s\n"
" plug-in path: %s\n"
printf("Starting sems " SEMS_VERSION "\n"
" configuration file: %s\n"
" plug-in path: %s\n"
#ifndef DISABLE_DAEMON_MODE
" daemon mode: %s\n"
" daemon UID: %s\n"
" daemon GID: %s\n"
" daemon mode: %s\n"
" daemon UID: %s\n"
" daemon GID: %s\n"
#endif
"\n",
#ifdef _DEBUG
log_level2str[AmConfig.log_level], AmConfig.log_level,
AmConfig.log_stderr ? "yes" : "no",
#endif
AmLcConfig::instance().config_path.c_str(),
AmConfig.modules_path.c_str()
#ifndef DISABLE_DAEMON_MODE
Expand All @@ -569,8 +561,6 @@ int main(int argc, char* argv[])
);
fflush(stdout);

AmLcConfig::instance().dump_Ifs();

/*printf("-----BEGIN CFG DUMP-----\n"
"%s\n"
"-----END CFG DUMP-----\n",
Expand Down Expand Up @@ -756,29 +746,29 @@ int main(int argc, char* argv[])
goto error;
}

INFO("Starting application timer scheduler");
DBG("Starting application timer scheduler");
AmAppTimer::instance()->start();
AmThreadWatcher::instance()->add(AmAppTimer::instance());

INFO("Starting session container");
DBG("Starting session container");
AmSessionContainer::instance()->start();

#ifdef SESSION_THREADPOOL
INFO("Starting session processor threads");
DBG("Starting session processor threads");
AmSessionProcessor::addThreads(AmConfig.session_proc_threads);
#endif
AmSessionProcessor::init();

INFO("Starting audio recorder");
DBG("Starting audio recorder");
AmAudioFileRecorderProcessor::instance()->start();

INFO("Starting pcap recorder");
DBG("Starting pcap recorder");
PcapFileRecorderProcessor::instance()->start();

INFO("Starting media processor");
DBG("Starting media processor");
AmMediaProcessor::instance()->init();

INFO("Starting stun processor");
DBG("Starting stun processor");
stun_processor::instance()->start();

// init thread usage with libevent
Expand All @@ -791,15 +781,15 @@ int main(int argc, char* argv[])
// start the asynchronous file writer (sorry, no better place...)
//async_file_writer::instance()->start();

INFO("Starting RTP receiver");
DBG("Starting RTP receiver");
AmRtpReceiver::instance()->start();

INFO("Starting SIP stack (control interface)");
DBG("Starting SIP stack (control interface)");
if(sip_ctrl.load()) {
goto error;
}

INFO("Loading plug-ins");
DBG("Loading plug-ins");
AmPlugIn::instance()->init();

if(AmPlugIn::instance()->load(AmConfig.modules_path, AmConfig.modules))
Expand Down Expand Up @@ -863,7 +853,7 @@ int main(int argc, char* argv[])

AmPlugIn::instance()->shutdown();
// session container stops active sessions
INFO("Disposing session container");
DBG("Disposing session container");
AmSessionContainer::dispose();

/*INFO("Disposing app timer");
Expand All @@ -876,29 +866,29 @@ int main(int argc, char* argv[])
cleanup_transaction();

if(AmConfig.enable_rtsp) {
INFO("Disposing RTSP client");
DBG("Disposing RTSP client");
RtspClient::dispose();
}

INFO("Disposing RTP receiver");
DBG("Disposing RTP receiver");
AmRtpReceiver::dispose();

INFO("Stop session processor");
DBG("Stop session processor");
AmSessionProcessor::stop();

INFO("Disposing media processor");
DBG("Disposing media processor");
AmMediaProcessor::dispose();

INFO("Disposing stun processor");
DBG("Disposing stun processor");
stun_processor::dispose();

INFO("Disposing audio file recorder");
DBG("Disposing audio file recorder");
AmAudioFileRecorderProcessor::dispose();

INFO("Disposing pcap file recorder");
DBG("Disposing pcap file recorder");
PcapFileRecorderProcessor::dispose();

INFO("Disposing event dispatcher");
DBG("Disposing event dispatcher");
AmEventDispatcher::dispose();

//async_file_writer::instance()->stop();
Expand All @@ -925,7 +915,7 @@ int main(int argc, char* argv[])

AmThreadWatcher::instance()->cleanup();

INFO("Disposing plug-ins");
DBG("Disposing plug-ins");
AmPlugIn::dispose();

stream_stats::dispose();
Expand Down
Loading

0 comments on commit 0355485

Please sign in to comment.