1. Encapsulation of the log class is a good thing in order to facilitate the use of log print logs and subsequent ease of revocation of log printing.
1 PackageMarket.phone;2 3 ImportAndroid.util.Log;4 5 /**6 * Self-encapsulated log class, press Yes to debug or actual7 * Created by Administrator on 2017/6/13.8 */9 Ten Public classLogU { One /*m default does not print log, if you want to print, set to True*/ A Private Static BooleanEnablelog =false; - - Public Static voidLe (String tag,string msg) { the if(Enablelog) - LOG.E (tag,msg); - - } + Public Static voidLd (String tag,string msg) { - if(Enablelog) + log.d (tag,msg); A at } - - Public Static voidLi (String tag,string msg) { - if(Enablelog) - log.i (tag,msg); - in } - Public Static voidLv (String tag,string msg) { to if(Enablelog) + log.v (tag,msg); - the } * Public Static voidLw (String tag,string msg) { $ if(Enablelog)Panax Notoginseng LOG.W (tag,msg); - the } + A the}
2. To achieve our print log requirements by modifying the value of the Enablelog
Package for the log class in Android