mirror of
https://github.com/onionshare/onionshare.git
synced 2025-02-14 21:51:32 -05:00
Rename debug to verbose in all relevant places
This commit is contained in:
parent
f7a62fe93a
commit
d5c60f8f70
@ -61,7 +61,7 @@ def main(cwd=None):
|
|||||||
parser.add_argument('--stealth', action='store_true', dest='stealth', help=strings._("help_stealth"))
|
parser.add_argument('--stealth', action='store_true', dest='stealth', help=strings._("help_stealth"))
|
||||||
parser.add_argument('--receive', action='store_true', dest='receive', help=strings._("help_receive"))
|
parser.add_argument('--receive', action='store_true', dest='receive', help=strings._("help_receive"))
|
||||||
parser.add_argument('--config', metavar='config', default=False, help=strings._('help_config'))
|
parser.add_argument('--config', metavar='config', default=False, help=strings._('help_config'))
|
||||||
parser.add_argument('--debug', action='store_true', dest='debug', help=strings._("help_debug"))
|
parser.add_argument('-v', '--verbose', action='store_true', dest='verbose', help=strings._("help_verbose"))
|
||||||
parser.add_argument('filename', metavar='filename', nargs='*', help=strings._('help_filename'))
|
parser.add_argument('filename', metavar='filename', nargs='*', help=strings._('help_filename'))
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ def main(cwd=None):
|
|||||||
filenames[i] = os.path.abspath(filenames[i])
|
filenames[i] = os.path.abspath(filenames[i])
|
||||||
|
|
||||||
local_only = bool(args.local_only)
|
local_only = bool(args.local_only)
|
||||||
debug = bool(args.debug)
|
verbose = bool(args.verbose)
|
||||||
stay_open = bool(args.stay_open)
|
stay_open = bool(args.stay_open)
|
||||||
autostart_timer = int(args.autostart_timer)
|
autostart_timer = int(args.autostart_timer)
|
||||||
autostop_timer = int(args.autostop_timer)
|
autostop_timer = int(args.autostop_timer)
|
||||||
@ -108,8 +108,8 @@ def main(cwd=None):
|
|||||||
# Re-load the strings, in case the provided config has changed locale
|
# Re-load the strings, in case the provided config has changed locale
|
||||||
strings.load_strings(common)
|
strings.load_strings(common)
|
||||||
|
|
||||||
# Debug mode?
|
# Verbose mode?
|
||||||
common.debug = debug
|
common.verbose = verbose
|
||||||
|
|
||||||
# Create the Web object
|
# Create the Web object
|
||||||
web = Web(common, False, mode)
|
web = Web(common, False, mode)
|
||||||
|
@ -36,8 +36,8 @@ class Common(object):
|
|||||||
"""
|
"""
|
||||||
The Common object is shared amongst all parts of OnionShare.
|
The Common object is shared amongst all parts of OnionShare.
|
||||||
"""
|
"""
|
||||||
def __init__(self, debug=False):
|
def __init__(self, verbose=False):
|
||||||
self.debug = debug
|
self.verbose = verbose
|
||||||
|
|
||||||
# The platform OnionShare is running on
|
# The platform OnionShare is running on
|
||||||
self.platform = platform.system()
|
self.platform = platform.system()
|
||||||
@ -57,9 +57,9 @@ class Common(object):
|
|||||||
|
|
||||||
def log(self, module, func, msg=None):
|
def log(self, module, func, msg=None):
|
||||||
"""
|
"""
|
||||||
If debug mode is on, log error messages to stdout
|
If verbose mode is on, log error messages to stdout
|
||||||
"""
|
"""
|
||||||
if self.debug:
|
if self.verbose:
|
||||||
timestamp = time.strftime("%b %d %Y %X")
|
timestamp = time.strftime("%b %d %Y %X")
|
||||||
|
|
||||||
final_msg = "[{}] {}.{}".format(timestamp, module, func)
|
final_msg = "[{}] {}.{}".format(timestamp, module, func)
|
||||||
|
@ -51,9 +51,9 @@ class Web(object):
|
|||||||
template_folder=self.common.get_resource_path('templates'))
|
template_folder=self.common.get_resource_path('templates'))
|
||||||
self.app.secret_key = self.common.random_string(8)
|
self.app.secret_key = self.common.random_string(8)
|
||||||
|
|
||||||
# Debug mode?
|
# Verbose mode?
|
||||||
if self.common.debug:
|
if self.common.verbose:
|
||||||
self.debug_mode()
|
self.verbose_mode()
|
||||||
|
|
||||||
# Are we running in GUI mode?
|
# Are we running in GUI mode?
|
||||||
self.is_gui = is_gui
|
self.is_gui = is_gui
|
||||||
@ -193,7 +193,7 @@ class Web(object):
|
|||||||
self.slug = self.common.build_slug()
|
self.slug = self.common.build_slug()
|
||||||
self.common.log('Web', 'generate_slug', 'built random slug: "{}"'.format(self.slug))
|
self.common.log('Web', 'generate_slug', 'built random slug: "{}"'.format(self.slug))
|
||||||
|
|
||||||
def debug_mode(self):
|
def verbose_mode(self):
|
||||||
"""
|
"""
|
||||||
Turn on debugging mode, which will log flask errors to a debug file.
|
Turn on debugging mode, which will log flask errors to a debug file.
|
||||||
"""
|
"""
|
||||||
|
@ -81,7 +81,7 @@ def main():
|
|||||||
# Parse arguments
|
# Parse arguments
|
||||||
parser = argparse.ArgumentParser(formatter_class=lambda prog: argparse.HelpFormatter(prog,max_help_position=48))
|
parser = argparse.ArgumentParser(formatter_class=lambda prog: argparse.HelpFormatter(prog,max_help_position=48))
|
||||||
parser.add_argument('--local-only', action='store_true', dest='local_only', help=strings._("help_local_only"))
|
parser.add_argument('--local-only', action='store_true', dest='local_only', help=strings._("help_local_only"))
|
||||||
parser.add_argument('--debug', action='store_true', dest='debug', help=strings._("help_debug"))
|
parser.add_argument('-v', '--verbose', action='store_true', dest='verbose', help=strings._("help_verbose"))
|
||||||
parser.add_argument('--filenames', metavar='filenames', nargs='+', help=strings._('help_filename'))
|
parser.add_argument('--filenames', metavar='filenames', nargs='+', help=strings._('help_filename'))
|
||||||
parser.add_argument('--config', metavar='config', default=False, help=strings._('help_config'))
|
parser.add_argument('--config', metavar='config', default=False, help=strings._('help_config'))
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
@ -98,10 +98,10 @@ def main():
|
|||||||
strings.load_strings(common)
|
strings.load_strings(common)
|
||||||
|
|
||||||
local_only = bool(args.local_only)
|
local_only = bool(args.local_only)
|
||||||
debug = bool(args.debug)
|
verbose = bool(args.verbose)
|
||||||
|
|
||||||
# Debug mode?
|
# Verbose mode?
|
||||||
common.debug = debug
|
common.verbose = verbose
|
||||||
|
|
||||||
# Validation
|
# Validation
|
||||||
if filenames:
|
if filenames:
|
||||||
|
@ -268,7 +268,7 @@ class TestLog:
|
|||||||
def dummy_func():
|
def dummy_func():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
common_obj.debug = True
|
common_obj.verbose = True
|
||||||
|
|
||||||
# From: https://stackoverflow.com/questions/1218933
|
# From: https://stackoverflow.com/questions/1218933
|
||||||
with io.StringIO() as buf, contextlib.redirect_stdout(buf):
|
with io.StringIO() as buf, contextlib.redirect_stdout(buf):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user