diff --git a/third_party/statsd-client-cpp/src/statsd_client.cpp b/third_party/statsd-client-cpp/src/statsd_client.cpp index e58af652..ca39e865 100644 --- a/third_party/statsd-client-cpp/src/statsd_client.cpp +++ b/third_party/statsd-client-cpp/src/statsd_client.cpp @@ -221,7 +221,6 @@ int StatsdClient::send(const string &message) int StatsdClient::send_to_daemon(const string &message) { - std::cout << "send_to_daemon: " << message.length() << " B" << std::endl; int ret = init(); if ( ret ) { diff --git a/ws/ws_cobra_to_statsd.cpp b/ws/ws_cobra_to_statsd.cpp index fb1e104f..cadcfed7 100644 --- a/ws/ws_cobra_to_statsd.cpp +++ b/ws/ws_cobra_to_statsd.cpp @@ -13,6 +13,7 @@ #include #include +#include namespace ix { @@ -90,20 +91,20 @@ namespace ix { if (eventType == ix::CobraConnection_EventType_Open) { - std::cout << "Subscriber: connected" << std::endl; + spdlog::info("Subscriber connected"); for (auto it : headers) { - std::cerr << it.first << ": " << it.second << std::endl; + spdlog::info("{}: {}", it.first, it.second); } } if (eventType == ix::CobraConnection_EventType_Closed) { - std::cout << "Subscriber: closed" << std::endl; + spdlog::info("Subscriber closed"); } else if (eventType == ix::CobraConnection_EventType_Authenticated) { - std::cout << "Subscriber authenticated" << std::endl; + spdlog::info("Subscriber authenticated"); conn.subscribe(channel, [&jsonWriter, &statsdClient, verbose, &tokens, &prefix, &msgCount] @@ -111,7 +112,7 @@ namespace ix { if (verbose) { - std::cout << jsonWriter.write(msg) << std::endl; + spdlog::info(jsonWriter.write(msg)); } std::string id; @@ -121,22 +122,22 @@ namespace ix id += extractAttr(attr, msg); } - std::cout << msgCount++ << " " << prefix << id << std::endl; + spdlog::info("{} {}{}", msgCount++, prefix, id); statsdClient.count(id, 1); }); } else if (eventType == ix::CobraConnection_EventType_Subscribed) { - std::cout << "Subscriber: subscribed to channel " << subscriptionId << std::endl; + spdlog::info("Subscriber: subscribed to channel {}", subscriptionId); } else if (eventType == ix::CobraConnection_EventType_UnSubscribed) { - std::cout << "Subscriber: unsubscribed from channel " << subscriptionId << std::endl; + spdlog::info("Subscriber: unsubscribed from channel {}", subscriptionId); } else if (eventType == ix::CobraConnection_EventType_Error) { - std::cout << "Subscriber: error" << errMsg << std::endl; + spdlog::error("Subscriber: error {}", errMsg); } } );