[tor-commits] [arm/master] Moving EVENT_LISTING to configuration

atagar at torproject.org atagar at torproject.org
Sun Dec 22 02:29:08 UTC 2013


commit e0eda56d993758460027d759b8385cc2f3535bab
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Dec 21 16:43:00 2013 -0800

    Moving EVENT_LISTING to configuration
    
    Another multi-line message that belongs in our config.
---
 arm/arguments.py |    5 ++---
 arm/logPanel.py  |   13 ++-----------
 arm/settings.cfg |   11 +++++++++++
 3 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/arm/arguments.py b/arm/arguments.py
index 4f796cc..aa90ed7 100644
--- a/arm/arguments.py
+++ b/arm/arguments.py
@@ -6,13 +6,12 @@ import collections
 import getopt
 import os
 
-import arm.logPanel
-
 import stem.connection
 import stem.util.conf
 
 CONFIG = stem.util.conf.config_dict("arm", {
   'attribute.debug_log_path': '',
+  'msg.event_types': '',
   'msg.help': '',
 })
 
@@ -113,5 +112,5 @@ def get_help():
     config = DEFAULT_ARGS['config'],
     debug_path = CONFIG['attribute.debug_log_path'],
     events = DEFAULT_ARGS['logged_events'],
-    event_flags = arm.logPanel.EVENT_LISTING,
+    event_flags = CONFIG['msg.event_types'],
   )
diff --git a/arm/logPanel.py b/arm/logPanel.py
index f020c57..01b34f4 100644
--- a/arm/logPanel.py
+++ b/arm/logPanel.py
@@ -28,16 +28,6 @@ TOR_EVENT_TYPES = {
   "e": "ERR",     "c": "CIRC",             "p": "NS",           "v": "STATUS_SERVER",
                   "j": "CLIENTS_SEEN",     "q": "ORCONN"}
 
-EVENT_LISTING = """        d DEBUG      a ADDRMAP           k DESCCHANGED   s STREAM
-        i INFO       f AUTHDIR_NEWDESCS  g GUARD         r STREAM_BW
-        n NOTICE     h BUILDTIMEOUT_SET  l NEWCONSENSUS  t STATUS_CLIENT
-        w WARN       b BW                m NEWDESC       u STATUS_GENERAL
-        e ERR        c CIRC              p NS            v STATUS_SERVER
-                     j CLIENTS_SEEN      q ORCONN
-          DINWE tor runlevel+            A All Events
-          12345 arm runlevel+            X No Events
-                                         U Unknown Events"""
-
 RUNLEVEL_EVENT_COLOR = {log.DEBUG: "magenta", log.INFO: "blue", log.NOTICE: "green",
                         log.WARN: "yellow", log.ERR: "red"}
 DAYBREAK_EVENT = "DAYBREAK" # special event for marking when the date changes
@@ -66,6 +56,7 @@ CONFIG = conf.config_dict("arm", {
   "features.log.maxRefreshRate": 300,
   "features.log.regex": [],
   "cache.logPanel.size": 1000,
+  "msg.event_types": '',
 }, conf_handler)
 
 DUPLICATE_MSG = " [%i duplicate%s hidden]"
@@ -760,7 +751,7 @@ class LogPanel(panel.Panel, threading.Thread, logging.Handler):
         # displays the available flags
         popup.win.box()
         popup.addstr(0, 0, "Event Types:", curses.A_STANDOUT)
-        eventLines = EVENT_LISTING.split("\n")
+        eventLines = CONFIG['msg.event_types'].split("\n")
 
         for i in range(len(eventLines)):
           popup.addstr(i + 1, 1, eventLines[i][6:])
diff --git a/arm/settings.cfg b/arm/settings.cfg
index d5a34ba..a69869f 100644
--- a/arm/settings.cfg
+++ b/arm/settings.cfg
@@ -75,6 +75,17 @@ msg.unknown_term
 |Either update your terminfo database or run arm using "TERM=xterm arm".
 |
 
+msg.event_types
+|        d DEBUG      a ADDRMAP           k DESCCHANGED   s STREAM
+|        i INFO       f AUTHDIR_NEWDESCS  g GUARD         r STREAM_BW
+|        n NOTICE     h BUILDTIMEOUT_SET  l NEWCONSENSUS  t STATUS_CLIENT
+|        w WARN       b BW                m NEWDESC       u STATUS_GENERAL
+|        e ERR        c CIRC              p NS            v STATUS_SERVER
+|                     j CLIENTS_SEEN      q ORCONN
+|          DINWE tor runlevel+            A All Events
+|          12345 arm runlevel+            X No Events
+|                                         U Unknown Events
+
 # Important tor configuration options (shown by default)
 config.important BandwidthRate
 config.important BandwidthBurst





More information about the tor-commits mailing list