How the Android program hits log

Source: Internet
Author: User

Common practice:

1. Define a constant (variable) as the flag for whether to output log;

2. Define a constant (variable) as the log level setting;

2. When debugging, packaging, adjust the value of the constant as needed to control log printing.

Common code References:

http://blog.csdn.net/zhanghw0917/article/details/27541641

Https://github.com/oronno/log4android See this project's SRC

The most humble way of personal use:

1. Define a constant as a switch to print log;

2. When printing Log, write directly, similar to if (Canlog) {log.d ("xxx")};

Why would I do this?

Because when you're not going to hit log, you don't want to let the code for log msg execute, just make a judgment.

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.