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

Source: Internet
Author: User

Android.util.Log class, which can be conveniently used to print logs during encoding debugging.

However, in the post-announcement product, it is assumed that there are too many logs to print. can severely affect performance.

make a simple package for the Android.util.Log class. Set debug to False when the product is to be published.

Code such as the following.

public class Logutil {/** is set to False*/private final static Boolean debug = True;private final static String TAG = "Oyp" when officially on-line; public static void V (string tag, string msg) {if (debug) {LOG.V (tag, msg);}} public static void V (String msg) {if (debug) {log.v (TAG, MSG);}} public static void D (string tag, string msg) {if (debug) {LOG.D (tag, msg);}} public static void D (String msg) {if (debug) {log.d (TAG, MSG);}} public static void I (string tag, string msg) {if (debug) {LOG.I (tag, msg);}} public static void I (String msg) {if (debug) {log.i (TAG, MSG);}} public static void W (string tag, string msg) {if (debug) {LOG.W (tag, msg);}} public static void W (String msg) {if (debug) {LOG.W (TAG, MSG);}} public static void E (string tag, string msg) {if (debug) {LOG.E (tag, msg);}} public static void E (String msg) {if (debug) {log.e (TAG, MSG);}}}




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

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

Reprint please keep the original address : 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.