Package for the log class in Android

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.