summaryrefslogtreecommitdiff
path: root/src/cprlisten.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/cprlisten.cc')
-rw-r--r--src/cprlisten.cc12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/cprlisten.cc b/src/cprlisten.cc
index 9ecac86..62deede 100644
--- a/src/cprlisten.cc
+++ b/src/cprlisten.cc
@@ -34,8 +34,9 @@ using namespace std;
#define MAGIC_STOP_STRING "SHUTTHEFUCKUP"
-CPRListen::CPRListen(unsigned short port)
+CPRListen::CPRListen(Info *info, unsigned short port)
{
+ this->info = info;
this->port = port;
cpr = "N/A";
cprchanged = false;
@@ -54,12 +55,13 @@ void CPRListen::stop()
socket.connect("localhost", port);
socket.send_string(MAGIC_STOP_STRING);
} catch(Network_error &e) {
- cerr << "In stop(): " << e.error << endl;
+ info.error("In stop(): %s.", e.error.c_str());
}
}
void CPRListen::thread_main()
{
+ info.info("Listening for CPRs.");
while(running) {
try {
string newcpr;
@@ -74,15 +76,15 @@ void CPRListen::thread_main()
cprchanged = true;
cpr = newcpr;
mutex.unlock();
- // cerr << "Got CPR: " << cpr << endl;
+ info.info("Got CPR: %s.", cpr.c_str());
}
} catch(Network_error &e) {
- cerr << "In thread_main(): " << e.error << endl;
+ info.error("In thread_main(): %s.", e.error.c_str());
running = false;
}
}
- // cout << "fisk!" << endl;
+ info.info("Stopped listening for CPRs.");
}
bool CPRListen::cprChanged()