Skip to content

Commit

Permalink
Merge pull request #2911 from andrewbaldwin44/feature/display-arguments
Browse files Browse the repository at this point in the history
Improve Web UI Logging
  • Loading branch information
cyberw authored Sep 25, 2024
2 parents 737e2b1 + bf9d47c commit cbdcdc6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions locust/argument_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions locust/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion locust/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit cbdcdc6

Please sign in to comment.