mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-01 10:46:19 -05:00
When enabling debug mode in Web, use common.build_data_dir() to get data dir path
This commit is contained in:
parent
043237bc20
commit
a06bb0878f
@ -184,19 +184,7 @@ class Web(object):
|
|||||||
"""
|
"""
|
||||||
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.
|
||||||
"""
|
"""
|
||||||
if self.common.platform == 'Windows':
|
flask_debug_filename = os.path.join(self.common.build_data_dir(), 'flask_debug.log')
|
||||||
try:
|
|
||||||
appdata = os.environ['APPDATA']
|
|
||||||
flask_debug_filename = '{}\\OnionShare\\flask_debug.log'.format(appdata)
|
|
||||||
except:
|
|
||||||
# If for some reason we don't have the 'APPDATA' environment variable
|
|
||||||
# (like running tests in Linux while pretending to be in Windows)
|
|
||||||
flask_debug_filename = os.path.expanduser('~/.config/onionshare/flask_debug.log')
|
|
||||||
elif self.common.platform == 'Darwin':
|
|
||||||
flask_debug_filename = os.path.expanduser('~/Library/Application Support/OnionShare/flask_debug.log')
|
|
||||||
else:
|
|
||||||
flask_debug_filename = os.path.expanduser('~/.config/onionshare/flask_debug.log')
|
|
||||||
|
|
||||||
log_handler = logging.FileHandler(flask_debug_filename)
|
log_handler = logging.FileHandler(flask_debug_filename)
|
||||||
log_handler.setLevel(logging.WARNING)
|
log_handler.setLevel(logging.WARNING)
|
||||||
self.app.logger.addHandler(log_handler)
|
self.app.logger.addHandler(log_handler)
|
||||||
|
Loading…
Reference in New Issue
Block a user