Code example for Logger

Methods: info, warning

0
            wifiLock = createWiFiLock();
        } 
 
        if (enable) {
            if (wifiLock.isHeld()) {
                log.warning("WiFi lock already acquired");
            } else { 
                log.info("WiFi lock acquired");
                wifiLock.acquire();
            } 
        } else { 
            if (wifiLock.isHeld()) {
                log.info("WiFi lock released");
                wifiLock.release();
            } else { 
                log.warning("WiFi lock already released");
            } 
        } 
    } 
 
    protected WifiManager.WifiLock createWiFiLock() {
        int wifiMode = WifiManager.WIFI_MODE_FULL;
        try { 
            // TODO: What's this? 
            Field f = WifiManager.class.getField("WIFI_MODE_FULL_HIGH_PERF");
            wifiMode = f.getInt(null);
        } catch (Exception e) {
            // Ignore 
        } 
        WifiManager.WifiLock wifiLock =
            wifiManager.createWifiLock(wifiMode, getClass().getSimpleName());
        log.info("Created WiFi lock, mode: " + wifiMode);
        return wifiLock;
    } 
 
    /** 
     * Can be overriden by subclasses to do additional work.