Ignore:
Timestamp:
2013-09-23T16:47:50+02:00 (6 years ago)
Author:
Don-vip
Message:

Rework console output:

  • new log level "error"
  • Replace nearly all calls to system.out and system.err to Main.(error|warn|info|debug)
  • Remove some unnecessary debug output
  • Some messages are modified (removal of "Info", "Warning", "Error" from the message itself -> notable i18n impact but limited to console error messages not seen by the majority of users, so that's ok)
Location:
trunk/src/org/openstreetmap/josm/actions
Files:
10 edited

Legend:

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

    r6084 r6248  
    4343        String ret =  pattern.matcher(baseUrl).replaceAll("/browse");
    4444        if (ret.equals(baseUrl)) {
    45             System.out.println(tr("WARNING: unexpected format of API base URL. Redirection to info or history page for OSM object will probably fail. API base URL is: ''{0}''",baseUrl));
     45            Main.warn(tr("Unexpected format of API base URL. Redirection to info or history page for OSM object will probably fail. API base URL is: ''{0}''",baseUrl));
    4646        }
    4747        if (ret.startsWith("http://api.openstreetmap.org/")) {
     
    6262        String ret =  pattern.matcher(baseUrl).replaceAll("/user");
    6363        if (ret.equals(baseUrl)) {
    64             System.out.println(tr("WARNING: unexpected format of API base URL. Redirection to user page for OSM user will probably fail. API base URL is: ''{0}''",baseUrl));
     64            Main.warn(tr("Unexpected format of API base URL. Redirection to user page for OSM user will probably fail. API base URL is: ''{0}''",baseUrl));
    6565        }
    6666        if (ret.startsWith("http://api.openstreetmap.org/")) {
  • trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java

    r6069 r6248  
    99import java.io.IOException;
    1010import java.net.MalformedURLException;
     11
    1112import javax.swing.Action;
    1213import javax.swing.ImageIcon;
     
    1516import javax.swing.JPanel;
    1617import javax.swing.JScrollPane;
     18
    1719import org.openstreetmap.josm.Main;
    1820import org.openstreetmap.josm.data.imagery.ImageryInfo;
     
    2123import org.openstreetmap.josm.gui.actionsupport.AlignImageryPanel;
    2224import org.openstreetmap.josm.gui.layer.ImageryLayer;
     25import org.openstreetmap.josm.gui.preferences.imagery.WMSLayerTree;
    2326import org.openstreetmap.josm.io.imagery.WMSImagery;
    24 import org.openstreetmap.josm.gui.preferences.imagery.WMSLayerTree;
    2527import org.openstreetmap.josm.tools.GBC;
    2628import org.openstreetmap.josm.tools.ImageProvider;
     
    7880            wms.attemptGetCapabilities(info.getUrl());
    7981
    80             System.out.println(wms.getLayers());
    8182            final WMSLayerTree tree = new WMSLayerTree();
    8283            tree.updateTree(wms);
     
    108109            JOptionPane.showMessageDialog(Main.parent, tr("Could not parse WMS layer list."),
    109110                    tr("WMS Error"), JOptionPane.ERROR_MESSAGE);
    110             System.err.println("Could not parse WMS layer list. Incoming data:");
    111             System.err.println(ex.getIncomingData());
     111            Main.error("Could not parse WMS layer list. Incoming data:\n"+ex.getIncomingData());
    112112        }
    113113        return null;
  • trunk/src/org/openstreetmap/josm/actions/OpenFileAction.java

    r6084 r6248  
    303303                        Utils.close(reader);
    304304                    } catch (Exception e) {
    305                         System.err.println(e.getMessage());
     305                        Main.error(e);
    306306                    }
    307307                }
  • trunk/src/org/openstreetmap/josm/actions/SimplifyWayAction.java

    r6131 r6248  
    3333import org.openstreetmap.josm.tools.Shortcut;
    3434
     35/**
     36 * Delete unnecessary nodes from a way
     37 */
    3538public class SimplifyWayAction extends JosmAction {
     39   
     40    /**
     41     * Constructs a new {@code SimplifyWayAction}.
     42     */
    3643    public SimplifyWayAction() {
    3744        super(tr("Simplify Way"), "simplify", tr("Delete unnecessary nodes from a way."), Shortcut.registerShortcut("tools:simplify", tr("Tool: {0}", tr("Simplify Way")),
     
    4148
    4249    protected boolean confirmWayWithNodesOutsideBoundingBox(List<? extends OsmPrimitive> primitives) {
    43         System.out.println(primitives);
    4450        return DeleteCommand.checkAndConfirmOutlyingDelete(Main.map.mapView.getEditLayer(), primitives, null);
    4551    }
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmChangeTask.java

    r6031 r6248  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.actions.downloadtasks;
     3
     4import static org.openstreetmap.josm.tools.I18n.tr;
    35
    46import java.util.Date;
     
    810import java.util.Map;
    911import java.util.concurrent.Future;
    10 
    11 import static org.openstreetmap.josm.tools.I18n.tr;
    1212
    1313import org.openstreetmap.josm.Main;
     
    184184                            data.setVisible(hp.isVisible());
    185185                        } catch (IllegalStateException e) {
    186                             System.err.println("Cannot change visibility for "+p+": "+e.getMessage());
     186                            Main.error("Cannot change visibility for "+p+": "+e.getMessage());
    187187                        }
    188188                        data.setTimestamp(hp.getTimestamp());
     
    196196                            it.remove();
    197197                        } catch (AssertionError e) {
    198                             System.err.println("Cannot load "+p + ": " + e.getMessage());
     198                            Main.error("Cannot load "+p + ": " + e.getMessage());
    199199                        }
    200200                    }
  • trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadOsmTask.java

    r6069 r6248  
    206206            } catch(Exception e) {
    207207                if (isCanceled()) {
    208                     System.out.println(tr("Ignoring exception because download has been canceled. Exception was: {0}", e.toString()));
     208                    Main.info(tr("Ignoring exception because download has been canceled. Exception was: {0}", e.toString()));
    209209                    return;
    210210                }
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DeleteAction.java

    r6084 r6248  
    116116            Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.KEY_EVENT_MASK);
    117117        } catch (SecurityException ex) {
    118             System.out.println(ex);
     118            Main.warn(ex);
    119119        }
    120120    }
     
    127127            Toolkit.getDefaultToolkit().removeAWTEventListener(this);
    128128        } catch (SecurityException ex) {
    129             System.out.println(ex);
     129            Main.warn(ex);
    130130        }
    131131        removeHighlighting();
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

    r6246 r6248  
    13651365                    snapAngles[i] = 360-Double.parseDouble(s); i++;
    13661366                } catch (NumberFormatException e) {
    1367                     System.err.println("Warning: incorrect number in draw.anglesnap.angles preferences: "+s);
     1367                    Main.warn("Incorrect number in draw.anglesnap.angles preferences: "+s);
    13681368                    snapAngles[i]=0;i++;
    13691369                    snapAngles[i]=0;i++;
  • trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java

    r6106 r6248  
    683683                    break;
    684684                } else {
    685                     System.out.println("Unknown char in SearchSettings: " + s);
     685                    Main.warn("Unknown char in SearchSettings: " + s);
    686686                    break;
    687687                }
  • trunk/src/org/openstreetmap/josm/actions/upload/ApiPreconditionCheckerHook.java

    r6084 r6248  
    5353            for (String key: osmPrimitive.keySet()) {
    5454                String value = osmPrimitive.get(key);
    55                 if(key.length() > 255) {
     55                if (key.length() > 255) {
    5656                    if (osmPrimitive.isDeleted()) {
    57                         // if OsmPrimitive is going to be deleted we automatically shorten the
    58                         // value
    59                         System.out.println(
    60                                 tr("Warning: automatically truncating value of tag ''{0}'' on deleted object {1}",
     57                        // if OsmPrimitive is going to be deleted we automatically shorten the value
     58                        Main.warn(
     59                                tr("Automatically truncating value of tag ''{0}'' on deleted object {1}",
    6160                                        key,
    6261                                        Long.toString(osmPrimitive.getId())
Note: See TracChangeset for help on using the changeset viewer.