diff options
author | Micah Lee <micah@micahflee.com> | 2019-04-19 09:48:39 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-19 09:48:39 -0700 |
commit | e5366bdf0b77f53363349e76ad594a6d457775fa (patch) | |
tree | 3c2035875023a1074c4f59c869e3ba6c2566dba5 /onionshare | |
parent | 6ffa91fcee406cb0a67177da233b371b2fbbfc2e (diff) | |
parent | e3357192ba2c52aaf9e233f0349ccbb3868b122c (diff) | |
download | onionshare-e5366bdf0b77f53363349e76ad594a6d457775fa.tar.gz onionshare-e5366bdf0b77f53363349e76ad594a6d457775fa.zip |
Merge pull request #959 from micahflee/958_verbose
Rename --debug to --verbose
Diffstat (limited to 'onionshare')
-rw-r--r-- | onionshare/__init__.py | 8 | ||||
-rw-r--r-- | onionshare/common.py | 8 | ||||
-rw-r--r-- | onionshare/web/web.py | 14 |
3 files changed, 15 insertions, 15 deletions
diff --git a/onionshare/__init__.py b/onionshare/__init__.py index db97f46d..248ab68c 100644 --- a/onionshare/__init__.py +++ b/onionshare/__init__.py @@ -61,7 +61,7 @@ def main(cwd=None): 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('--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')) args = parser.parse_args() @@ -70,7 +70,7 @@ def main(cwd=None): filenames[i] = os.path.abspath(filenames[i]) local_only = bool(args.local_only) - debug = bool(args.debug) + verbose = bool(args.verbose) stay_open = bool(args.stay_open) autostart_timer = int(args.autostart_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 strings.load_strings(common) - # Debug mode? - common.debug = debug + # Verbose mode? + common.verbose = verbose # Create the Web object web = Web(common, False, mode) diff --git a/onionshare/common.py b/onionshare/common.py index 02668507..325f11d4 100644 --- a/onionshare/common.py +++ b/onionshare/common.py @@ -36,8 +36,8 @@ class Common(object): """ The Common object is shared amongst all parts of OnionShare. """ - def __init__(self, debug=False): - self.debug = debug + def __init__(self, verbose=False): + self.verbose = verbose # The platform OnionShare is running on self.platform = platform.system() @@ -57,9 +57,9 @@ class Common(object): 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") final_msg = "[{}] {}.{}".format(timestamp, module, func) diff --git a/onionshare/web/web.py b/onionshare/web/web.py index b61d2fb3..ebfff2f3 100644 --- a/onionshare/web/web.py +++ b/onionshare/web/web.py @@ -54,9 +54,9 @@ class Web(object): template_folder=self.common.get_resource_path('templates')) self.app.secret_key = self.common.random_string(8) - # Debug mode? - if self.common.debug: - self.debug_mode() + # Verbose mode? + if self.common.verbose: + self.verbose_mode() # Are we running in GUI mode? self.is_gui = is_gui @@ -196,12 +196,12 @@ class Web(object): self.slug = self.common.build_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 verbose mode, which will log flask errors to a file. """ - flask_debug_filename = os.path.join(self.common.build_data_dir(), 'flask_debug.log') - log_handler = logging.FileHandler(flask_debug_filename) + flask_log_filename = os.path.join(self.common.build_data_dir(), 'flask.log') + log_handler = logging.FileHandler(flask_log_filename) log_handler.setLevel(logging.WARNING) self.app.logger.addHandler(log_handler) |