Android Open Source - flightmode P Log






From Project

Back to project page flightmode.

License

The source code is released under:

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> Everyone is permitted to copy and distribute v...

If you think the Android project flightmode listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.aja.flightmode;
//from  w ww.  j ava 2  s. c o  m
import android.util.Log;

/**
 * Log wrapper to behave according to isLoggable()
 */
public class PLog {

  // any priority
  public static void println(int priority, String tag, String msg) {
    if (Log.isLoggable(tag, priority)) { Log.println(priority, tag, msg); }
  }

  // DEBUG
  public static void d(String tag, String msg) {
    if (Log.isLoggable(tag, Log.DEBUG)) { Log.d(tag, msg); }
  }
  public static void d(String tag, String msg, Throwable tr) {
    if (Log.isLoggable(tag, Log.DEBUG)) { Log.d(tag, msg, tr); }
  }

  // ERROR
  public static void e(String tag, String msg) {
    if (Log.isLoggable(tag, Log.ERROR)) { Log.e(tag, msg); }
  }
  public static void e(String tag, String msg, Throwable tr) {
    if (Log.isLoggable(tag, Log.ERROR)) { Log.e(tag, msg, tr); }
  }

  // INFO
  public static void i(String tag, String msg) {
    if (Log.isLoggable(tag, Log.INFO)) { Log.i(tag, msg); }
  }
  public static void i(String tag, String msg, Throwable tr) {
    if (Log.isLoggable(tag, Log.INFO)) { Log.i(tag, msg, tr); }
  }

  // VERBOSE
  public static void v(String tag, String msg) {
    if (Log.isLoggable(tag, Log.VERBOSE)) { Log.v(tag, msg); }
  }
  public static void v(String tag, String msg, Throwable tr) {
    if (Log.isLoggable(tag, Log.VERBOSE)) { Log.v(tag, msg, tr); }
  }

  // WARN
  public static void w(String tag, String msg) {
    if (Log.isLoggable(tag, Log.WARN)) { Log.w(tag, msg); }
  }
  public static void w(String tag, String msg, Throwable tr) {
    if (Log.isLoggable(tag, Log.WARN)) { Log.w(tag, msg, tr); }
  }
  public static void w(String tag, Throwable tr) {
    if (Log.isLoggable(tag, Log.WARN)) { Log.w(tag, tr); }
  }

  // WTF needs API level 8
//  public static void wtf(String tag, String msg) {
//    if (Log.isLoggable(tag, Log.ASSERT)) { Log.wtf(tag, msg); }
//  }
//  public static void wtf(String tag, String msg, Throwable tr) {
//    if (Log.isLoggable(tag, Log.ASSERT)) { Log.wtf(tag, msg, tr); }
//  }
//  public static void wtf(String tag, Throwable tr) {
//    if (Log.isLoggable(tag, Log.ASSERT)) { Log.wtf(tag, tr); }
//  }

}




Java Source Code List

org.aja.flightmode.FlightmodeAppWidgetProvider.java
org.aja.flightmode.PLog.java