mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-10 19:52:50 -03:00
added error logging into webapp
This commit is contained in:
parent
03d2053eff
commit
f3e31cab31
1 changed files with 18 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
from flask import Flask, render_template
|
||||
import threading, json, os, time
|
||||
import threading, json, os, time, platform
|
||||
|
||||
onionshare = None
|
||||
onionshare_port = None
|
||||
|
@ -10,7 +10,24 @@ clipboard = None
|
|||
|
||||
url = None
|
||||
|
||||
# figure out this platform's temp dir
|
||||
if platform.system() == 'Windows':
|
||||
temp_dir = os.environ['Temp'].replace('\\', '/')
|
||||
else:
|
||||
temp_dir = '/tmp/'
|
||||
|
||||
# suppress output in windows
|
||||
if platform.system() == 'Windows':
|
||||
sys.stdout = open('{0}/onionshare.stdout.log'.format(temp_dir), 'w')
|
||||
sys.stderr = open('{0}/onionshare.stderr.log'.format(temp_dir), 'w')
|
||||
|
||||
# log web errors to file
|
||||
import logging
|
||||
log_handler = logging.FileHandler('{0}/onionshare.web.log'.format(temp_dir))
|
||||
log_handler.setLevel(logging.WARNING)
|
||||
|
||||
app = Flask(__name__, template_folder='./templates')
|
||||
app.logger.addHandler(log_handler)
|
||||
|
||||
@app.route("/")
|
||||
def index():
|
||||
|
|
Loading…
Reference in a new issue