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/io/OsmReader.java

    r6093 r6248  
    1818import javax.xml.stream.XMLStreamReader;
    1919
     20import org.openstreetmap.josm.Main;
    2021import org.openstreetmap.josm.data.Bounds;
    2122import org.openstreetmap.josm.data.coor.LatLon;
     
    171172                Bounds copy = new Bounds(bounds);
    172173                bounds.normalize();
    173                 System.out.println("Bbox " + copy + " is out of the world, normalized to " + bounds);
     174                Main.info("Bbox " + copy + " is out of the world, normalized to " + bounds);
    174175            }
    175176            DataSource src = new DataSource(bounds, origin);
     
    233234        }
    234235        if (w.isDeleted() && !nodeIds.isEmpty()) {
    235             System.out.println(tr("Deleted way {0} contains nodes", w.getUniqueId()));
     236            Main.info(tr("Deleted way {0} contains nodes", w.getUniqueId()));
    236237            nodeIds = new ArrayList<Long>();
    237238        }
     
    280281        }
    281282        if (r.isDeleted() && !members.isEmpty()) {
    282             System.out.println(tr("Deleted relation {0} contains members", r.getUniqueId()));
     283            Main.info(tr("Deleted relation {0} contains members", r.getUniqueId()));
    283284            members = new ArrayList<RelationMemberData>();
    284285        }
     
    356357    protected void parseUnknown(boolean printWarning) throws XMLStreamException {
    357358        if (printWarning) {
    358             System.out.println(tr("Undefined element ''{0}'' found in input stream. Skipping.", parser.getLocalName()));
     359            Main.info(tr("Undefined element ''{0}'' found in input stream. Skipping.", parser.getLocalName()));
    359360        }
    360361        while (true) {
     
    445446                    throwException(tr("Illegal value for attribute ''version'' on OSM primitive with ID {0}. Got {1}.", Long.toString(current.getUniqueId()), versionString));
    446447                } else if (version < 0 && current.getUniqueId() <= 0) {
    447                     System.out.println(tr("WARNING: Normalizing value of attribute ''version'' of element {0} to {2}, API version is ''{3}''. Got {1}.", current.getUniqueId(), version, 0, "0.6"));
     448                    Main.warn(tr("Normalizing value of attribute ''version'' of element {0} to {2}, API version is ''{3}''. Got {1}.", current.getUniqueId(), version, 0, "0.6"));
    448449                    version = 0;
    449450                }
    450451            } else if (ds.getVersion().equals("0.5")) {
    451452                if (version <= 0 && current.getUniqueId() > 0) {
    452                     System.out.println(tr("WARNING: Normalizing value of attribute ''version'' of element {0} to {2}, API version is ''{3}''. Got {1}.", current.getUniqueId(), version, 1, "0.5"));
     453                    Main.warn(tr("Normalizing value of attribute ''version'' of element {0} to {2}, API version is ''{3}''. Got {1}.", current.getUniqueId(), version, 1, "0.5"));
    453454                    version = 1;
    454455                } else if (version < 0 && current.getUniqueId() <= 0) {
    455                     System.out.println(tr("WARNING: Normalizing value of attribute ''version'' of element {0} to {2}, API version is ''{3}''. Got {1}.", current.getUniqueId(), version, 0, "0.5"));
     456                    Main.warn(tr("Normalizing value of attribute ''version'' of element {0} to {2}, API version is ''{3}''. Got {1}.", current.getUniqueId(), version, 0, "0.5"));
    456457                    version = 0;
    457458                }
     
    467468            } else if (current.getUniqueId() > 0 && ds.getVersion() != null && ds.getVersion().equals("0.5")) {
    468469                // default version in 0.5 files for existing primitives
    469                 System.out.println(tr("WARNING: Normalizing value of attribute ''version'' of element {0} to {2}, API version is ''{3}''. Got {1}.", current.getUniqueId(), version, 1, "0.5"));
     470                Main.warn(tr("Normalizing value of attribute ''version'' of element {0} to {2}, API version is ''{3}''. Got {1}.", current.getUniqueId(), version, 1, "0.5"));
    470471                version= 1;
    471472            } else if (current.getUniqueId() <= 0 && ds.getVersion() != null && ds.getVersion().equals("0.5")) {
     
    496497                if (current.getUniqueId() <= 0) {
    497498                    // for a new primitive we just log a warning
    498                     System.out.println(tr("Illegal value for attribute ''changeset'' on new object {1}. Got {0}. Resetting to 0.", v, current.getUniqueId()));
     499                    Main.info(tr("Illegal value for attribute ''changeset'' on new object {1}. Got {0}. Resetting to 0.", v, current.getUniqueId()));
    499500                    current.setChangesetId(0);
    500501                } else {
     
    506507                if (current.getUniqueId() <= 0) {
    507508                    // for a new primitive we just log a warning
    508                     System.out.println(tr("Illegal value for attribute ''changeset'' on new object {1}. Got {0}. Resetting to 0.", v, current.getUniqueId()));
     509                    Main.info(tr("Illegal value for attribute ''changeset'' on new object {1}. Got {0}. Resetting to 0.", v, current.getUniqueId()));
    509510                    current.setChangesetId(0);
    510511                } else {
Note: See TracChangeset for help on using the changeset viewer.