zoukankan      html  css  js  c++  java
  • Android-LogUtil-工具类

    LogUtil-工具类 是专门Log日志打印 和 Toast的提示,的公共方法

    package common.library.utils;
    
    import android.content.Context;
    import android.util.Log;
    import android.widget.Toast;
    
    /**
     * @Author Liudeli
     * @Describe:Log日志级别打印相关工具类
     */
    public class LogUtil {
    
        private LogUtil(){}
    
        /**
         * 打印的信息日志信息
         */
        private final static String INFO = "☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻☻: ";
    
        /**
         * 打印的错误日志信息
         */
        private final static String ERROR = "✖✖✖✖✖✖✖✖✖✖✖✖✖✖✖✖✖✖✖✖✖✖✖✖✖✖: ";
    
        /**
         * 打印的调试日志信息
         */
        private final static String DEBUG = "☠☠☠☠☠☠☠☠☠☠☠☠☠☠☠: ";
    
        /**
         * 打印的全面日志信息
         */
        private final static String VERBOSE = "▂▂▂▃▃▄▄▅▅▆▆▆▇▇: ";
    
        /**
         * 打印的警告日志信息
         */
        private final static String WARN = "!!!!!!!!!!!!!!!!!!!!!!!!!!: ";
    
        /**
         * 打印information日志
         * @param tag 标签
         * @param msg 日志信息
         */
        public static void i(String tag,String msg){
            Log.i(tag, INFO + msg);
        }
    
        /**
         * 打印information日志
         * @param tag    标签
         * @param msg    日志信息
         * @param throwable    异常
         */
        public static void i(String tag, String msg, Throwable throwable){
            Log.i(tag, INFO + msg, throwable);
        }
    
        /**
         * 打印verbose日志
         * @param tag    标签
         * @param msg    日志信息
         */
        public static void v(String tag, String msg){
            Log.v(tag, VERBOSE + msg);
        }
    
        /**
         * 打印verbose日志
         * @param tag    标签
         * @param msg    日志信息
         * @param throwable    异常
         */
        public static void v(String tag, String msg, Throwable throwable){
            Log.v(tag, VERBOSE + msg, throwable);
        }
    
        /**
         * 打印debug信息
         * @param tag    标签信息
         * @param msg    日志信息
         */
        public static void d(String tag, String msg){
            Log.d(tag, DEBUG + msg);
        }
    
        /**
         * 打印debug日志
         * @param tag    标签信息
         * @param msg    日志信息
         * @param throwable    异常
         */
        public static void d(String tag, String msg, Throwable throwable){
            Log.d(tag, DEBUG + msg, throwable);
        }
    
        /**
         * 打印warn日志
         * @param tag    标签信息
         * @param msg    日志信息
         */
        public static void w(String tag, String msg){
            Log.w(tag, WARN + msg);
        }
    
        /**
         * 打印warn日志
         * @param tag    标签信息
         * @param msg    日志信息
         * @param throwable    异常
         */
        public static void w(String tag, String msg, Throwable throwable){
            Log.w(tag, WARN + msg, throwable);
        }
    
        /**
         * 打印error日志
         * @param tag
         * @param msg    标签
         */
        public static void e(String tag, String msg){
            Log.e(tag, ERROR + msg);
        }
    
        /**
         * 打印error日志
         * @param tag    标签
         * @param msg    日志信息
         * @param throwable    异常
         */
        public static void e(String tag, String msg, Throwable throwable){
            Log.e(tag, ERROR + msg, throwable);
        }
    
        /**
         * 吐司提示
         * @param msg
         */
        public static void toast(Context mContext, String msg) {
            Toast.makeText(mContext, msg, Toast.LENGTH_SHORT).show();
        }
    
        /**
         * 吐司提示 long类型
         * @param msg
         */
        public static void toastL(Context mContext, String msg) {
            Toast.makeText(mContext, msg, Toast.LENGTH_SHORT).show();
        }
    
        /**
         * 吐司提示 自定义时间类型
         * @param msg
         */
        public static void toastD(Context mContext, String msg, int duration) {
            Toast.makeText(mContext, msg, duration).show();
        }
    }
  • 相关阅读:
    datetimepicker 日期值显示不完全(点击按钮后)
    南昌旋风科技有限公司的评价很烂,擅自修改dns域名解析。也不通知客户,导致34天无法解析。
    2009年树种铁树种子,每个特价3元一个!
    asp.net c# 如何读取XML文件里的CDATA里的HTML
    招商银行开始抢钱了,月管理费5元。2009年7月开始,杭州的招行是这样的。准备注销账号了
    圆通快递服务台太恶劣了,强烈要求抵制圆通快递。
    asp.net c#里如何使用 varchar(max) 参数
    MasterPage 和 page 事件顺序
    window7 安装 Microsoft SQL Server 2008 Enterprise Edition 需要注意的问题
    探讨下Tag标签的数据库设计(千万级数据量)
  • 原文地址:https://www.cnblogs.com/android-deli/p/10170067.html
Copyright © 2011-2022 走看看