Browse Source

Specify the log levels to save for nodes

The logs to generate can be specified for each node with the
'log_files' argument.
Steven Engler 2 years ago
parent
commit
c75ecfadd7
2 changed files with 10 additions and 4 deletions
  1. 8 0
      lib/chutney/TorNet.py
  2. 2 4
      torrc_templates/common.i

+ 8 - 0
lib/chutney/TorNet.py

@@ -1100,6 +1100,7 @@ DEFAULTS = {
     'nick_base': 'test',
     'valgrind_settings': None,
     'add_environ_vars': None,
+    'log_files': ['notice', 'info', 'debug'],
 }
 
 
@@ -1152,6 +1153,13 @@ class TorEnviron(chutney.Templating.Environ):
     def __init__(self, parent=None, **kwargs):
         chutney.Templating.Environ.__init__(self, parent=parent, **kwargs)
 
+    def _get_log_file_lines(self, my):
+        lines = []
+        for log_type in self['log_files']:
+            path = os.path.join(self['dir'], log_type) + '.log'
+            lines.append('Log {0} file {1}'.format(log_type, path))
+        return '\n'.join(lines)
+
     def _get_orport(self, my):
         return my['orport_base'] + my['nodenum']
 

+ 2 - 4
torrc_templates/common.i

@@ -43,10 +43,8 @@ ControlSocket ${dir}/control
 CookieAuthentication 1
 PidFile ${dir}/pid
 
-Log notice file ${dir}/notice.log
-Log info file ${dir}/info.log
-# Turn this off to save space
-#Log debug file ${dir}/debug.log
+${log_file_lines}
+
 ProtocolWarnings 1
 SafeLogging 0
 LogTimeGranularity 1