From 2af14639de9f575ac9a2766835206e5c6ffb46c8 Mon Sep 17 00:00:00 2001
From: Rider Linden <rider@lindenlab.com>
Date: Fri, 20 Nov 2015 12:24:53 -0800
Subject: [PATCH] MAINT-5835: Cut down on log spam from coros and voice.

---
 indra/llcommon/llcoros.cpp     | 44 ++++++++++++++++++++++++++++++++--
 indra/newview/llvoicevivox.cpp |  3 ++-
 2 files changed, 44 insertions(+), 3 deletions(-)

diff --git a/indra/llcommon/llcoros.cpp b/indra/llcommon/llcoros.cpp
index d76401d01b3..548a6d22be0 100755
--- a/indra/llcommon/llcoros.cpp
+++ b/indra/llcommon/llcoros.cpp
@@ -91,6 +91,8 @@ LLCoros::LLCoros():
 
 bool LLCoros::cleanup(const LLSD&)
 {
+    static std::string previousName;
+    static int previousCount = 0;
     // Walk the mCoros map, checking and removing completed coroutines.
     for (CoroMap::iterator mi(mCoros.begin()), mend(mCoros.end()); mi != mend; )
     {
@@ -98,7 +100,24 @@ bool LLCoros::cleanup(const LLSD&)
         // since last tick?
         if (mi->second->mCoro.exited())
         {
-            LL_INFOS("LLCoros") << "LLCoros: cleaning up coroutine " << mi->first << LL_ENDL;
+            if (previousName != mi->first)
+            { 
+                previousName = mi->first;
+                previousCount = 1;
+            }
+            else
+            {
+                ++previousCount;
+            }
+               
+            if ((previousCount < 5) || !(previousCount % 50))
+            {
+                if (previousCount < 5)
+                    LL_INFOS("LLCoros") << "LLCoros: cleaning up coroutine " << mi->first << LL_ENDL;
+                else
+                    LL_INFOS("LLCoros") << "LLCoros: cleaning up coroutine " << mi->first << "("<< previousCount << ")" << LL_ENDL;
+
+            }
             // The erase() call will invalidate its passed iterator value --
             // so increment mi FIRST -- but pass its original value to
             // erase(). This is what postincrement is all about.
@@ -116,6 +135,9 @@ bool LLCoros::cleanup(const LLSD&)
 
 std::string LLCoros::generateDistinctName(const std::string& prefix) const
 {
+    static std::string previousName;
+    static int previousCount = 0;
+
     // Allowing empty name would make getName()'s not-found return ambiguous.
     if (prefix.empty())
     {
@@ -132,7 +154,25 @@ std::string LLCoros::generateDistinctName(const std::string& prefix) const
     {
         if (mCoros.find(name) == mCoros.end())
         {
-            LL_INFOS("LLCoros") << "LLCoros: launching coroutine " << name << LL_ENDL;
+            if (previousName != name)
+            {
+                previousName = name;
+                previousCount = 1;
+            }
+            else
+            {
+                ++previousCount;
+            }
+
+            if ((previousCount < 5) || !(previousCount % 50))
+            {
+                if (previousCount < 5)
+                    LL_INFOS("LLCoros") << "LLCoros: launching coroutine " << name << LL_ENDL;
+                else
+                    LL_INFOS("LLCoros") << "LLCoros: launching coroutine " << name << "(" << previousCount << ")" << LL_ENDL;
+
+            }
+
             return name;
         }
     }
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index d14fac5fb82..1425499b125 100755
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -3970,7 +3970,8 @@ void LLVivoxVoiceClient::parcelVoiceInfoRequestCoro(std::string url)
         }
     }
 
-    LL_INFOS("Voice") << "Voice URI is " << uri << LL_ENDL;
+    if (!uri.empty())
+        LL_INFOS("Voice") << "Voice URI is " << uri << LL_ENDL;
 
     // set the spatial channel.  If no voice credentials or uri are 
     // available, then we simply drop out of voice spatially.
-- 
GitLab