Add --debug-web flag to conditionally enable Flask access logs

parent 7990ce26
...@@ -220,6 +220,12 @@ Examples: ...@@ -220,6 +220,12 @@ Examples:
help='Enable debug mode' help='Enable debug mode'
) )
parser.add_argument(
'--debug-web',
action='store_true',
help='Enable web server debug logging (access logs)'
)
# Database configuration options # Database configuration options
parser.add_argument( parser.add_argument(
'--db-type', '--db-type',
...@@ -462,6 +468,8 @@ Examples: ...@@ -462,6 +468,8 @@ Examples:
# Start web process # Start web process
web_cmd = [sys.executable, '-m', 'vidai.web'] web_cmd = [sys.executable, '-m', 'vidai.web']
if args.debug_web:
web_cmd.append('--debug-web')
web_proc = subprocess.Popen(web_cmd) web_proc = subprocess.Popen(web_cmd)
# Start cluster master in a separate thread # Start cluster master in a separate thread
......
...@@ -1636,8 +1636,18 @@ def serve_logo(): ...@@ -1636,8 +1636,18 @@ def serve_logo():
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser(description='VidAI Web Interface') parser = argparse.ArgumentParser(description='VidAI Web Interface')
parser.add_argument('--server-dir', type=str, help='Server directory for local file access (admin only)') parser.add_argument('--server-dir', type=str, help='Server directory for local file access (admin only)')
parser.add_argument('--debug-web', action='store_true', help='Enable web server debug logging (access logs)')
args = parser.parse_args() args = parser.parse_args()
# Configure Flask logging based on debug-web flag
if not args.debug_web:
import logging
# Disable Flask/Werkzeug access logs
log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR)
# Also disable Flask app logger
app.logger.setLevel(logging.ERROR)
# Set global server directory # Set global server directory
server_dir = args.server_dir server_dir = args.server_dir
if server_dir: if server_dir:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment