Changeset 16069 in josm


Ignore:
Timestamp:
2020-03-08T09:25:04+01:00 (12 months ago)
Author:
simon04
Message:

see #18752 - Harmonize stopwatch logging

Location:
trunk/src/org/openstreetmap/josm
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/MergeLayerAction.java

    r15786 r16069  
    9090                    }
    9191
    92                     Logging.info(tr("{0} completed in {1}", actionName, stopwatch));
     92                    Logging.info(stopwatch.toString(String.valueOf(actionName)));
    9393                });
    9494            }
     
    114114            if (layerMerged) {
    115115                getLayerManager().setActiveLayer(targetLayer);
    116                 Logging.info(tr("{0} completed in {1}", actionName, stopwatch));
     116                Logging.info(stopwatch.toString(String.valueOf(actionName)));
    117117            }
    118118        });
  • trunk/src/org/openstreetmap/josm/data/osm/DatasetConsistencyTest.java

    r16068 r16069  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.data.osm;
    3 
    4 import static org.openstreetmap.josm.tools.I18n.tr;
    53
    64import java.io.PrintWriter;
     
    189187            StackTraceElement item = Thread.currentThread().getStackTrace()[2];
    190188            String operation = getClass().getSimpleName() + '.' + item.getMethodName();
    191             Logging.debug(tr("{0} completed in {1}",
    192                     operation, stopwatch));
     189            Logging.debug(stopwatch.toString(operation));
    193190        }
    194191    }
  • trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java

    r15755 r16069  
    608608    public static synchronized void initializeTests() {
    609609        if (!testsInitialized) {
    610             Logging.debug("Initializing validator tests");
     610            final String message = "Initializing validator tests";
     611            Logging.debug(message);
    611612            final Stopwatch stopwatch = Stopwatch.createStarted();
    612613            initializeTests(getTests());
    613614            testsInitialized = true;
    614             Logging.debug("Initializing validator tests completed in {0}", stopwatch);
     615            Logging.debug(stopwatch.toString("Initializing validator tests"));
    615616        }
    616617    }
  • trunk/src/org/openstreetmap/josm/data/validation/Test.java

    r16068 r16069  
    198198        progressMonitor = null;
    199199        if (stopwatch.elapsed() > 0) {
    200             Logging.debug(tr("{0} completed in {1}", getName(), stopwatch));
     200            Logging.debug(stopwatch.toString(getName()));
    201201        }
    202202    }
  • trunk/src/org/openstreetmap/josm/gui/SplashScreen.java

    r15755 r16069  
    164164            }
    165165            if (stopwatch.elapsed() >= 0) {
     166                Logging.debug(stopwatch.toString(name));
    166167                duration = tr(" ({0})", stopwatch);
    167168            }
     
    299300            taskOptional.ifPresent(task -> {
    300301                ((MeasurableTask) task).finish();
    301                 if (Logging.isDebugEnabled()) {
    302                     Logging.debug(tr("{0} completed in {1}", title, ((MeasurableTask) task).duration));
    303                 }
    304302                listener.stateChanged(null);
    305303            });
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java

    r15755 r16069  
    488488        // show some debug info
    489489        if (Logging.isDebugEnabled() && !visibleSegments.isEmpty()) {
    490             Logging.debug("gpxdraw::draw takes " +
    491                          stopwatch +
     490            Logging.debug(stopwatch.toString("gpxdraw::draw") +
    492491                         "(" +
    493492                         "segments= " + visibleSegments.size() +
  • trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java

    r15902 r16069  
    308308        }
    309309        if (Logging.isDebugEnabled() || !source.isValid()) {
    310             String message = "Initializing map style " + source.url + " completed in " + stopwatch;
     310            String message = stopwatch.toString("Initializing map style " + source.url);
    311311            if (!source.isValid()) {
    312312                Logging.warn(message + " (" + source.getErrors().size() + " errors, " + source.getWarnings().size() + " warnings)");
  • trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetReader.java

    r15755 r16069  
    368368            }
    369369        }
    370         if (Logging.isDebugEnabled()) {
    371             Logging.debug("Presets read in {0}", stopwatch);
    372         }
     370        Logging.debug(stopwatch.toString("Reading presets"));
    373371        return tp;
    374372    }
  • trunk/src/org/openstreetmap/josm/tools/Stopwatch.java

    r15755 r16069  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.tools;
     3
     4import static org.openstreetmap.josm.tools.I18n.tr;
    35
    46/**
     
    4446        return Utils.getDurationString(Math.max(0, elapsed()));
    4547    }
     48
     49    /**
     50     * Formats the given task name and duration since start as i18n string
     51     * @param taskName the task name
     52     * @return the task name and duration since start as i18n string
     53     */
     54    public String toString(String taskName) {
     55        return tr("{0} completed in {1}", taskName, toString());
     56    }
    4657}
  • trunk/src/org/openstreetmap/josm/tools/XmlUtils.java

    r15755 r16069  
    8787        Logging.debug("Starting DOM parsing of {0}", is);
    8888        Document result = newSafeDOMBuilder().parse(is);
    89         Logging.debug("DOM parsing done in {0}", stopwatch);
     89        Logging.debug(stopwatch.toString("DOM parsing"));
    9090        return result;
    9191    }
     
    118118        Logging.debug("Starting SAX parsing of {0} using {1}", is, dh);
    119119        newSafeSAXParser().parse(is, dh);
    120         Logging.debug("SAX parsing done in {0}", stopwatch);
     120        Logging.debug(stopwatch.toString("SAX parsing"));
    121121    }
    122122
Note: See TracChangeset for help on using the changeset viewer.