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