From 0acc4ae7b088746f56b1a83668ddd7f1969d077e Mon Sep 17 00:00:00 2001 From: Pierre St Juste Date: Mon, 16 Dec 2013 15:46:57 -0500 Subject: [PATCH] Logging level is now set by controller in config --- src/controlleraccess.cc | 17 +++++++++++++---- src/tincan.cc | 1 - 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/controlleraccess.cc b/src/controlleraccess.cc index c760605..1c4b0a4 100644 --- a/src/controlleraccess.cc +++ b/src/controlleraccess.cc @@ -128,7 +128,6 @@ void ControllerAccess::HandlePacket(talk_base::AsyncPacketSocket* socket, if (data[0] != '{') return ProcessIPPacket(socket, data, len, addr); std::string result; std::string message(data, 0, len); - LOG_F(INFO) << message; Json::Reader reader; Json::Value root; if (!reader.parse(message, root)) { @@ -212,9 +211,19 @@ void ControllerAccess::HandlePacket(talk_base::AsyncPacketSocket* socket, } break; case SET_LOGGING: { - int flag = root["flag"].asInt(); - if (flag > 0) talk_base::LogMessage::LogToDebug(talk_base::LS_INFO); - else talk_base::LogMessage::LogToDebug(talk_base::LS_ERROR + 1); + int logging = root["logging"].asInt(); + if (logging == 0) { + talk_base::LogMessage::LogToDebug(talk_base::LS_ERROR + 1); + } + else if (logging == 1) { + talk_base::LogMessage::LogToDebug(talk_base::LS_ERROR); + } + else if (logging == 2) { + talk_base::LogMessage::LogToDebug(talk_base::LS_INFO); + } + else if (logging == 3) { + talk_base::LogMessage::LogToDebug(talk_base::LS_SENSITIVE); + } } break; default: { diff --git a/src/tincan.cc b/src/tincan.cc index d4fcdd1..32b11b9 100644 --- a/src/tincan.cc +++ b/src/tincan.cc @@ -102,7 +102,6 @@ bool SSLVerificationCallback(void* cert) { int main(int argc, char **argv) { talk_base::InitializeSSL(SSLVerificationCallback); - talk_base::LogMessage::LogToDebug(talk_base::LS_INFO); peerlist_init(); int translate = 1;