Changeset 30848 in osm for applications


Ignore:
Timestamp:
2014-12-13T20:04:25+01:00 (10 years ago)
Author:
bastik
Message:

allow external logging

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/viewer/jmapviewer/src/org/openstreetmap/gui/jmapviewer/FeatureAdapter.java

    r30223 r30848  
    77import java.net.URISyntaxException;
    88import java.text.MessageFormat;
     9import java.util.logging.Logger;
    910
    1011public class FeatureAdapter {
     
    1920    }
    2021
     22    public static interface LoggingAdapter {
     23        Logger getLogger(String name);
     24    }
     25
    2126    private static BrowserAdapter browserAdapter = new DefaultBrowserAdapter();
    2227    private static TranslationAdapter translationAdapter = new DefaultTranslationAdapter();
     28    private static LoggingAdapter loggingAdapter = new DefaultLoggingAdapter();
    2329
    2430    public static void registerBrowserAdapter(BrowserAdapter browserAdapter) {
     
    3036    }
    3137
     38    public static void registerLoggingAdapter(LoggingAdapter loggingAdapter) {
     39        FeatureAdapter.loggingAdapter = loggingAdapter;
     40    }
     41
    3242    public static void openLink(String url) {
    3343        browserAdapter.openLink(url);
     
    3646    public static String tr(String text, Object... objects) {
    3747        return translationAdapter.tr(text, objects);
     48    }
     49   
     50    public static Logger getLogger(String name) {
     51        return loggingAdapter.getLogger(name);
    3852    }
    3953
     
    6175        }
    6276    }
     77
     78    public static class DefaultLoggingAdapter implements LoggingAdapter {
     79        @Override
     80        public Logger getLogger(String name) {
     81            return Logger.getLogger(name);
     82        }
     83    }
    6384}
Note: See TracChangeset for help on using the changeset viewer.