My Android Step-by-step tour------>android A simple package for log

Source: Internet
Author: User

Android.util.Log class that can be conveniently used to print the log during encoding debugging. However, in a post-release product, if there is too much log printing, it can seriously affect performance. make a simple package for the Android.util.Log class and set debug to False when the product is to be published.

The code is as follows.

public class logutils{/** is formally set to false*/private static final Boolean Debug = true;    private static final String TAG = "OYP";    public static void I (string tag, string msg) {if (Debug) android.util.log.i (tag, tag + msg);    } public static void D (string tag, string msg) {if (Debug) ANDROID.UTIL.LOG.D (tag, tag + msg);    } public static void W (string tag, string msg) {if (Debug) ANDROID.UTIL.LOG.W (tag, tag + msg);  } public static void W (string tag, string msg, Throwable tr) {if (Debug) ANDROID.UTIL.LOG.W (tag, tag    + MSG, TR);    public static void V (string tag, string msg) {if (Debug) ANDROID.UTIL.LOG.V (tag, tag + msg);    } public static void E (string tag, string msg) {ANDROID.UTIL.LOG.E (tag, tag + msg);    public static void E (string tag, string msg, Throwable tr) {ANDROID.UTIL.LOG.E (tag, tag + msg, TR); }}

==================================================================================================

Ouyangpeng welcome reprint, sharing with people is the source of progress!

Reprint please keep the original address : Http://blog.csdn.net/ouyang_peng

==================================================================================================   


Copyright NOTICE: This article for Bo Master original article, welcome reprint, reprint please indicate source Http://blog.csdn.net/ouyang_peng

My Android Step-by-step tour------>android A simple package for log

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.