如何将Android日志工具类改写为支持长尾词查询的?
- 内容介绍
- 文章标签
- 相关推荐
本文共计222个文字,预计阅读时间需要1分钟。
javaimport android.util.Log;
public class Logger { // 全局的总开关 public static int LOWEST_LOG_LEVEL=0; // 0隐藏 7全部显示 // 最低日志显示级别 private static int SYSTEM=1;}
import android.util.Log; public class Logger { // public static int LOG_LEVEL = 0; // 全局的总开关 public static int LOWEST_LOG_LEVEL = 0;// 0隐藏 7全部显示 最低日志显示级别 private static int SYSTEM = 1; private static int VERBOS = 2; private static int DEBUG = 3; private static int INFO = 4; private static int WARN = 5; private static int ERROR = 6; public static void i(String tag, String message) { if(message==null){ return; } if (LOWEST_LOG_LEVEL <= INFO) {// Log.i(tag, message); } } public static void e(String tag, String message) { if(message==null){ return; } if (LOWEST_LOG_LEVEL <= ERROR) { Log.e(tag, message); } } public static void d(String tag, String message) { if(message==null){ return; } if (LOWEST_LOG_LEVEL <= DEBUG) { Log.d(tag, message); } } public static void w(String tag, String message) { if(message==null){ return; } if (LOWEST_LOG_LEVEL <= WARN) { Log.w(tag, message); } } public static void v(String tag, String message) { if(message==null){ return; } if (LOWEST_LOG_LEVEL <= VERBOS) { Log.v(tag, message); } } public static void s(String message) { if(message==null){ return; } if (LOWEST_LOG_LEVEL <= SYSTEM) { System.out.println(message); } } }
本文共计222个文字,预计阅读时间需要1分钟。
javaimport android.util.Log;
public class Logger { // 全局的总开关 public static int LOWEST_LOG_LEVEL=0; // 0隐藏 7全部显示 // 最低日志显示级别 private static int SYSTEM=1;}
import android.util.Log; public class Logger { // public static int LOG_LEVEL = 0; // 全局的总开关 public static int LOWEST_LOG_LEVEL = 0;// 0隐藏 7全部显示 最低日志显示级别 private static int SYSTEM = 1; private static int VERBOS = 2; private static int DEBUG = 3; private static int INFO = 4; private static int WARN = 5; private static int ERROR = 6; public static void i(String tag, String message) { if(message==null){ return; } if (LOWEST_LOG_LEVEL <= INFO) {// Log.i(tag, message); } } public static void e(String tag, String message) { if(message==null){ return; } if (LOWEST_LOG_LEVEL <= ERROR) { Log.e(tag, message); } } public static void d(String tag, String message) { if(message==null){ return; } if (LOWEST_LOG_LEVEL <= DEBUG) { Log.d(tag, message); } } public static void w(String tag, String message) { if(message==null){ return; } if (LOWEST_LOG_LEVEL <= WARN) { Log.w(tag, message); } } public static void v(String tag, String message) { if(message==null){ return; } if (LOWEST_LOG_LEVEL <= VERBOS) { Log.v(tag, message); } } public static void s(String message) { if(message==null){ return; } if (LOWEST_LOG_LEVEL <= SYSTEM) { System.out.println(message); } } }

