Use of logcat

Source: Internet
Author: User

Use of logcat

According to the definition in system/CORE/include/cutils/log. h:
49 /*
50 * normally we strip alogv (verbose messages) from release builds.
51 * you can modify this (for example with "# define log_ndebug 0"
52 * at the top of your source file) to change that behavior.
53 */

Alogv is valid only when # define log_ndebug 0 is placed in your code. Of course, you must put
# Include before <cutils/log. h>!
You can print the file name, function name, and row number as follows:
50 alogv ("Yasin test file = % s \ n", _ file __);
51 alogv ("Yasin test func = % s \ n", _ FUNC __);
52 alogv ("Yasin test line = % d \ n", _ line __);
The usage is the same as that of the kernel.

You can define a tag before your source code, for example:
# Define log_tag "Lights"
In this way, what logcat comes out in the future will be like this:
V/lights (422): Yasin test file = device/sprd/common/libs/liblights/lights. c
V/lights (422): Yasin test func = write_int
V/lights (422): Yasin test line = 52

Here, lights is your tag, and V represents the lowest priority.

You can also add some parameters to logcat, such as printing only your own logs based on tags, or printing only logs with a higher priority, for example:
Logcat lights: V *: S

The meaning here is to print only the tags with lights priority and higher than v. Other labels only print S-level labels. (S-level is the highest level) so that all other logs are filtered, leaving only the labels that are not lights. That is, only your logs about all levels of lights are left.

For more logcat usage reference: http://www.oschina.net/question/565065_67884

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.