From b69f69855de30e827f56cf320b30b365d150937e Mon Sep 17 00:00:00 2001 From: Andrew Baldwin Date: Wed, 25 Sep 2024 15:42:05 +0200 Subject: [PATCH 1/2] Add argument for displaying web host name --- locust/argument_parser.py | 6 ++++++ locust/main.py | 2 ++ 2 files changed, 8 insertions(+) diff --git a/locust/argument_parser.py b/locust/argument_parser.py index f24778e3d6..c0e490ba9b 100644 --- a/locust/argument_parser.py +++ b/locust/argument_parser.py @@ -424,6 +424,12 @@ def setup_parser_arguments(parser): help="Host to bind the web interface to. Defaults to '*' (all interfaces)", env_var="LOCUST_WEB_HOST", ) + web_ui_group.add_argument( + "--web-host-display-name", + type=str, + help=configargparse.SUPPRESS, + env_var="LOCUST_WEB_HOST_DISPLAY_NAME", + ) web_ui_group.add_argument( "--web-port", "-P", diff --git a/locust/main.py b/locust/main.py index 3aaecd97d0..fc97d9d84c 100644 --- a/locust/main.py +++ b/locust/main.py @@ -487,6 +487,8 @@ def ensure_user_class_name(config): web_host = options.web_host if web_host: logger.info(f"Starting web interface at {protocol}://{web_host}:{options.web_port}") + if options.web_host_display_name: + logger.info(f"Starting web interface at {options.web_host_display_name}") else: if os.name == "nt": logger.info( From bf9d47c4991377ec5b4f0353c541c5550a4ce690 Mon Sep 17 00:00:00 2001 From: Andrew Baldwin Date: Wed, 25 Sep 2024 15:44:58 +0200 Subject: [PATCH 2/2] Log 400-404 requests as DEBUG level --- locust/web.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locust/web.py b/locust/web.py index a8b0a1ca95..4fe6dc677c 100644 --- a/locust/web.py +++ b/locust/web.py @@ -150,7 +150,7 @@ def handle_exception(error): error_message = str(error) error_code = getattr(error, "code", 500) logger.log( - logging.INFO if error_code <= 404 else logging.ERROR, + logging.DEBUG if error_code <= 404 else logging.ERROR, f"UI got request for {request.path}, but it resulted in a {error_code}: {error.name}", ) return make_response(error_message, error_code)