[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [arm/master] Moving ResourceTracker log messages to config



commit 28287f7d0f15a81506d4c8ee83fc6cbc9b1235a7
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Wed Oct 30 08:56:21 2013 -0700

    Moving ResourceTracker log messages to config
    
    Couple of these are pretty long. Moving them to our config like other long
    user-facing strings.
---
 arm/settings.cfg    |    3 +++
 arm/util/tracker.py |   20 ++++++++++++++++----
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/arm/settings.cfg b/arm/settings.cfg
index ebbe273..6998de0 100644
--- a/arm/settings.cfg
+++ b/arm/settings.cfg
@@ -65,6 +65,9 @@ msg.unable_to_determine_pid Unable to determine Tor's pid. Some information, lik
 msg.unable_to_use_resolver Unable to query connections with {old_resolver}, trying {new_resolver}
 msg.unable_to_use_all_resolvers We were unable to use any of your system's resolvers to get tor's connections. This is fine, but means that the connections page will be empty. This is usually permissions related so if you would like to fix this then run arm with the same user as tor (ie, "sudo -u <tor user> arm").
 
+msg.unable_to_get_resources Unable to query process resource usage from {resolver} ({exc})
+msg.abort_getting_resources Failed three attempts to get process resource usage from {resolver}, {response} ({exc})
+
 msg.unknown_term
 |Unknown $TERM: ({term})
 |Either update your terminfo database or run arm using "TERM=xterm arm".
diff --git a/arm/util/tracker.py b/arm/util/tracker.py
index ea795d0..eb29a69 100644
--- a/arm/util/tracker.py
+++ b/arm/util/tracker.py
@@ -47,6 +47,8 @@ CONFIG = conf.config_dict('arm', {
   'queries.connections.rate': 5,
   'msg.unable_to_use_resolver': '',
   'msg.unable_to_use_all_resolvers': '',
+  'msg.unable_to_get_resources': '',
+  'msg.abort_getting_resources': '',
 })
 
 CONNECTION_TRACKER = None
@@ -365,17 +367,27 @@ class ResourceTracker(Daemon):
 
           self._use_proc = False
           self._failure_count = 0
-          log.info("Failed three attempts to get process resource usage from proc, falling back to ps (%s)" % exc)
+
+          log.info(CONFIG['msg.abort_getting_resources'].format(
+            resolver = 'proc',
+            response = 'falling back to ps',
+            exc = exc,
+          ))
         else:
-          log.debug("Unable to query process resource usage from proc (%s)" % exc)
+          log.debug(CONFIG['msg.unable_to_get_resources'].format(resolver = 'proc', exc = exc))
       else:
         if self._failure_count >= 3:
           # Give up on further attempts.
 
-          log.info("Failed three attempts to get process resource usage from ps, giving up on getting resource usage information (%s)" % exc)
+          log.info(CONFIG['msg.abort_getting_resources'].format(
+            resolver = 'ps',
+            response = 'giving up on getting resource usage information',
+            exc = exc,
+          ))
+
           self.stop()
         else:
-          log.debug("Unable to query process resource usage from ps (%s)" % exc)
+          log.debug(CONFIG['msg.unable_to_get_resources'].format(resolver = 'ps', exc = exc))
 
       return False
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits