Changeset 15799 in josm for trunk


Ignore:
Timestamp:
2020-01-30T11:43:18+01:00 (4 years ago)
Author:
simon04
Message:

HttpClient: add stopwatch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/HttpClient.java

    r15742 r15799  
    140140        boolean successfulConnection = false;
    141141        try {
     142            Stopwatch stopwatch = Stopwatch.createStarted();
    142143            ConnectionResponse cr;
    143144            try {
    144145                cr = performConnection();
    145146                final boolean hasReason = reasonForRequest != null && !reasonForRequest.isEmpty();
    146                 logRequest("{0} {1}{2} -> {3} {4}{5}",
     147                logRequest("{0} {1}{2} -> {3} {4} ({5}{6})",
    147148                        getRequestMethod(), getURL(), hasReason ? (" (" + reasonForRequest + ')') : "",
    148149                        cr.getResponseVersion(), cr.getResponseCode(),
     150                        stopwatch,
    149151                        cr.getContentLengthLong() > 0
    150                                 ? (" (" + Utils.getSizeString(cr.getContentLengthLong(), Locale.getDefault()) + ')')
     152                                ? ("; " + Utils.getSizeString(cr.getContentLengthLong(), Locale.getDefault()))
    151153                                : ""
    152154                );
     
    162164                }
    163165            } catch (IOException | RuntimeException e) {
    164                 logRequest("{0} {1} -> !!!", requestMethod, url);
     166                logRequest("{0} {1} -> !!! ({2})", requestMethod, url, stopwatch);
    165167                Logging.warn(e);
    166168                //noinspection ThrowableResultOfMethodCallIgnored
Note: See TracChangeset for help on using the changeset viewer.