Add --silent option to disable logging to terminal

This commit is contained in:
shortcutme 2017-06-20 20:32:51 +02:00
parent 0d6d19502f
commit 66e2192e65
No known key found for this signature in database
GPG Key ID: 5B63BAE6CB9613AE
3 changed files with 7 additions and 2 deletions

View File

@ -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')

View File

@ -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

View File

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