Browse Source

Add --silent option to disable logging to terminal

shortcutme 6 years ago
parent
commit
66e2192e65
3 changed files with 7 additions and 2 deletions
  1. 1 0
      src/Config.py
  2. 5 1
      src/main.py
  3. 1 1
      zeronet.py

+ 1 - 0
src/Config.py

@@ -168,6 +168,7 @@ class Config(object):
         # Config parameters
         self.parser.add_argument('--verbose', help='More detailed logging', action='store_true')
         self.parser.add_argument('--debug', help='Debug mode', action='store_true')
+        self.parser.add_argument('--silent', help='Disable logging to terminal output', action='store_true')
         self.parser.add_argument('--debug_socket', help='Debug socket connections', action='store_true')
         self.parser.add_argument('--debug_gevent', help='Debug gevent functions', action='store_true')
 

+ 5 - 1
src/main.py

@@ -76,9 +76,13 @@ if config.action == "main":
     )
 else:
     log_file_path = "%s/cmd.log" % config.log_dir
+    if config.silent:
+        level = logging.ERROR
+    else:
+        level = logging.DEBUG
     logging.basicConfig(
         format='[%(asctime)s] %(levelname)-8s %(name)s %(message)s',
-        level=logging.DEBUG, stream=open(log_file_path, "w")
+        level=level, stream=open(log_file_path, "w")
     )
 
 # Console logger

+ 1 - 1
zeronet.py

@@ -6,7 +6,7 @@ import sys
 
 
 def main():
-    print "- Starting ZeroNet..."
+        print "- Starting ZeroNet..."
 
     main = None
     try: