Ignore:
Timestamp:
2013-09-23T16:47:50+02:00 (11 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)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/CustomConfigurator.java

    r6235 r6248  
    236236            root = document.getDocumentElement();
    237237        } catch (Exception ex) {
    238             System.out.println("Error getting preferences to save:" +ex.getMessage());
     238            Main.warn("Error getting preferences to save:" +ex.getMessage());
    239239        }
    240240        if (root==null) return;
     
    265265            ts.transform(new DOMSource(exportDocument), new StreamResult(f.toURI().getPath()));
    266266        } catch (Exception ex) {
    267             System.out.println("Error saving preferences part: " +ex.getMessage());
     267            Main.warn("Error saving preferences part: " +ex.getMessage());
    268268            ex.printStackTrace();
    269269        }
     
    345345                        List<PluginInformation> toDeletePlugins = new ArrayList<PluginInformation>();
    346346                        for (PluginInformation pi: availablePlugins) {
    347                             //System.out.print(pi.name+";");
    348347                            String name = pi.name.toLowerCase();
    349348                            if (installList.contains(name)) toInstallPlugins.add(pi);
     
    355354                            Main.worker.submit(pluginDownloadTask);
    356355                        }
    357                             Collection<String> pls = new ArrayList<String>(Main.pref.getCollection("plugins"));
    358                             for (PluginInformation pi: toInstallPlugins) {
    359                                 if (!pls.contains(pi.name)) pls.add(pi.name);
     356                        Collection<String> pls = new ArrayList<String>(Main.pref.getCollection("plugins"));
     357                        for (PluginInformation pi: toInstallPlugins) {
     358                            if (!pls.contains(pi.name)) {
     359                                pls.add(pi.name);
    360360                            }
    361                             for (PluginInformation pi: toRemovePlugins) {
    362                                 pls.remove(pi.name);
    363                             }
    364                             for (PluginInformation pi: toDeletePlugins) {
    365                                 pls.remove(pi.name);
    366                                 new File(Main.pref.getPluginsDirectory(),pi.name+".jar").deleteOnExit();
    367                             }
    368                             System.out.println(pls);
    369                             Main.pref.putCollection("plugins",pls);
    370361                        }
     362                        for (PluginInformation pi: toRemovePlugins) {
     363                            pls.remove(pi.name);
     364                        }
     365                        for (PluginInformation pi: toDeletePlugins) {
     366                            pls.remove(pi.name);
     367                            new File(Main.pref.getPluginsDirectory(), pi.name+".jar").deleteOnExit();
     368                        }
     369                        Main.pref.putCollection("plugins",pls);
     370                    }
    371371                });
    372372            }
     
    949949    }
    950950
    951 
    952 
    953951    private static void defaultUnknownWarning(String key) {
    954952        log("Warning: Unknown default value of %s , skipped\n", key);
     
    961959
    962960    private static void showPrefs(Preferences tmpPref) {
    963         System.out.println("properties: " + tmpPref.properties);
    964         System.out.println("collections: " + tmpPref.collectionProperties);
    965         System.out.println("arrays: " + tmpPref.arrayProperties);
    966         System.out.println("maps: " + tmpPref.listOfStructsProperties);
     961        Main.info("properties: " + tmpPref.properties);
     962        Main.info("collections: " + tmpPref.collectionProperties);
     963        Main.info("arrays: " + tmpPref.arrayProperties);
     964        Main.info("maps: " + tmpPref.listOfStructsProperties);
    967965    }
    968966
     
    973971    }
    974972
    975 
    976      /**
     973    /**
    977974     * Convert JavaScript preferences object to preferences data structures
    978975     * @param engine - JS engine to put object
     
    10591056            tmpPref.listOfStructsProperties.put(e.getKey(), e.getValue());
    10601057        }
    1061 
    1062     }
    1063 
     1058    }
    10641059
    10651060    /**
     
    11531148            "}\n";
    11541149
    1155         //System.out.println("map1: "+stringMap );
    1156         //System.out.println("lists1: "+listMap );
    1157         //System.out.println("listlist1: "+listlistMap );
    1158         //System.out.println("listmap1: "+listmapMap );
    1159 
    11601150        // Execute conversion script
    11611151        engine.eval(init);
    1162 
    11631152    }
    11641153    }
Note: See TracChangeset for help on using the changeset viewer.