Ignore:
Timestamp:
2017-08-22T22:26:32+02:00 (7 years ago)
Author:
Don-vip
Message:

see #15182 - deprecate all Main logging methods and introduce suitable replacements in Logging for most of them

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r12279 r12620  
    223223        Logging.setLogLevel(logLevel);
    224224        if (!args.showVersion() && !args.showHelp()) {
    225             Main.info(tr("Log level is at {0} ({1}, {2})", logLevel.getLocalizedName(), logLevel.getName(), logLevel.intValue()));
     225            Logging.info(tr("Log level is at {0} ({1}, {2})", logLevel.getLocalizedName(), logLevel.getName(), logLevel.intValue()));
    226226        }
    227227
     
    263263        boolean skipLoadingPlugins = args.hasOption(Option.SKIP_PLUGINS);
    264264        if (skipLoadingPlugins) {
    265             Main.info(tr("Plugin loading skipped"));
     265            Logging.info(tr("Plugin loading skipped"));
    266266        }
    267267
     
    269269            // Enable debug in OAuth signpost via system preference, but only at trace level
    270270            Utils.updateSystemProperty("debug", "true");
    271             Main.info(tr("Enabled detailed debug level (trace)"));
     271            Logging.info(tr("Enabled detailed debug level (trace)"));
    272272        }
    273273
     
    306306            CustomConfigurator.XMLCommandProcessor config = new CustomConfigurator.XMLCommandProcessor(Main.pref);
    307307            for (String i : args.get(Option.LOAD_PREFERENCES)) {
    308                 info("Reading preferences from " + i);
     308                Logging.info("Reading preferences from " + i);
    309309                try (InputStream is = openStream(new URL(i))) {
    310310                    config.openAndReadXML(is);
     
    318318            CertificateAmendment.addMissingCertificates();
    319319        } catch (IOException | GeneralSecurityException ex) {
    320             Main.warn(ex);
    321             Main.warn(getErrorMessage(Utils.getRootCause(ex)));
     320            Logging.warn(ex);
     321            Logging.warn(Logging.getErrorMessage(Utils.getRootCause(ex)));
    322322        }
    323323        Authenticator.setDefault(DefaultAuthenticator.getInstance());
     
    387387                PlatformHookWindows.removeInsecureCertificates();
    388388            } catch (NoSuchAlgorithmException | CertificateException | KeyStoreException | IOException e) {
    389                 error(e);
     389                Logging.error(e);
    390390            }
    391391        }
     
    402402            // Repaint manager is registered so late for a reason - there is lots of violation during startup process
    403403            // but they don't seem to break anything and are difficult to fix
    404             info("Enabled EDT checker, wrongful access to gui from non EDT thread will be printed to console");
     404            Logging.info("Enabled EDT checker, wrongful access to gui from non EDT thread will be printed to console");
    405405            RepaintManager.setCurrentManager(new CheckThreadViolationRepaintManager());
    406406        }
     
    443443                    Main.setOffline(OnlineResource.valueOf(s.toUpperCase(Locale.ENGLISH)));
    444444                } catch (IllegalArgumentException e) {
    445                     Main.error(e, tr("''{0}'' is not a valid value for argument ''{1}''. Possible values are {2}, possibly delimited by commas.",
    446                             s.toUpperCase(Locale.ENGLISH), Option.OFFLINE.getName(), Arrays.toString(OnlineResource.values())));
     445                    Logging.log(Logging.LEVEL_ERROR,
     446                            tr("''{0}'' is not a valid value for argument ''{1}''. Possible values are {2}, possibly delimited by commas.",
     447                            s.toUpperCase(Locale.ENGLISH), Option.OFFLINE.getName(), Arrays.toString(OnlineResource.values())), e);
    447448                    System.exit(1);
    448449                    return;
     
    452453        Set<OnlineResource> offline = Main.getOfflineResources();
    453454        if (!offline.isEmpty()) {
    454             Main.warn(trn("JOSM is running in offline mode. This resource will not be available: {0}",
     455            Logging.warn(trn("JOSM is running in offline mode. This resource will not be available: {0}",
    455456                    "JOSM is running in offline mode. These resources will not be available: {0}",
    456457                    offline.size(), offline.size() == 1 ? offline.iterator().next() : Arrays.toString(offline.toArray())));
     
    480481                                Utils.updateSystemProperty("java.net.preferIPv6Addresses", "true");
    481482                                if (!wasv6) {
    482                                     Main.info(tr("Detected useable IPv6 network, prefering IPv6 over IPv4 after next restart."));
     483                                    Logging.info(tr("Detected useable IPv6 network, prefering IPv6 over IPv4 after next restart."));
    483484                                } else {
    484                                     Main.info(tr("Detected useable IPv6 network, prefering IPv6 over IPv4."));
     485                                    Logging.info(tr("Detected useable IPv6 network, prefering IPv6 over IPv4."));
    485486                                }
    486487                                hasv6 = true;
     
    490491                    }
    491492                } catch (IOException | SecurityException e) {
    492                     if (Main.isDebugEnabled()) {
    493                         Main.debug("Exception while checking IPv6 connectivity: "+e);
    494                     }
    495                     Main.trace(e);
     493                    Logging.debug("Exception while checking IPv6 connectivity: {0}", e);
     494                    Logging.trace(e);
    496495                }
    497496                if (wasv6 && !hasv6) {
    498                     Main.info(tr("Detected no useable IPv6 network, prefering IPv4 over IPv6 after next restart."));
     497                    Logging.info(tr("Detected no useable IPv6 network, prefering IPv4 over IPv6 after next restart."));
    499498                    Main.pref.put("validated.ipv6", hasv6); // be sure it is stored before the restart!
    500499                    try {
    501500                        RestartAction.restartJOSM();
    502501                    } catch (IOException e) {
    503                         Main.error(e);
     502                        Logging.error(e);
    504503                    }
    505504                }
Note: See TracChangeset for help on using the changeset viewer.