logi
This commit is contained in:
14
app.py
14
app.py
@@ -57,8 +57,8 @@ import pytesseract
|
||||
from collections import Counter
|
||||
from pytesseract import Output
|
||||
|
||||
#import logging
|
||||
#logging.getLogger("werkzeug").setLevel(logging.INFO)
|
||||
import logging
|
||||
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config.from_object(Config)
|
||||
@@ -618,6 +618,15 @@ def require_system_password():
|
||||
fixed_url = urlunparse(parsed._replace(netloc=request.host))
|
||||
return redirect(url_for("system_auth", next=fixed_url))
|
||||
|
||||
@app.after_request
|
||||
def log_request(response):
|
||||
log_msg = f"{request.remote_addr} - - [{request.method}] {request.path} {response.status_code}"
|
||||
if app.debug:
|
||||
app.logger.debug(log_msg)
|
||||
else:
|
||||
app.logger.info(log_msg)
|
||||
return response
|
||||
|
||||
|
||||
@app.template_filter("filemtime")
|
||||
def file_mtime_filter(path):
|
||||
@@ -2619,4 +2628,5 @@ def create_db():
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
logging.basicConfig(level=logging.DEBUG if DEBUG_MODE else logging.INFO)
|
||||
socketio.run(app, host="0.0.0.0", port=8000, debug=DEBUG_MODE)
|
||||
|
Reference in New Issue
Block a user