当前位置: 首页 > news >正文

湛江赤坎孵化器网站建设招聘培训机构网站

湛江赤坎孵化器网站建设招聘,培训机构网站,上海包装设计公司排名,wordpress seo 优化在开发Android一些应用或是链接库, 在程序代码中埋一些log是一定有需要的, 因为谁也无法保证自己所写出来的程序一定没有问题, 而log机制正是用来追踪bug途径的一种常用的方法. 在andorid中提供了logcat的机制来作log的目的, 在javalayer有logcat class可以用,哪在nativelayer呢…

在开发Android一些应用或是链接库, 在程序代码中埋一些log是一定有需要的, 因为谁也无法保证自己所写出来的程序一定没有问题, 而log机制正是用来追踪bug途径的一种常用的方法. 在andorid中提供了logcat的机制来作log的目的, 在javalayer有logcat class可以用,哪在nativelayer呢? 从android platform source code中不难发现, 其实在nativelayer也有一些跟logcat相关的log用法. 以下就从目前的aosp的source code中整理出来的log用法.

Header system/core/include/cutils/log.h
Library libcutils.so
Example 1. add shared lib to LOCAL_SHARED_LIBRARIES in Android.mk
LOCAL_SHARED_LIBRARIES += libcutils
2. add log define and include the header file in the top of the source file.
#define LOG_NDEBUG 0
#define LOG_TAG "XXX"
#include <cutils/log.h>
3. Use the function as below to print log in logcat.
ALOGV
ALOGD
ALOGI
ALOGW
ALOGE

Header frameworks/native/include/utils/Log.h
Library libutils.so
Example 1. add shared lib to LOCAL_SHARED_LIBRARIES in Android.mk
LOCAL_SHARED_LIBRARIES += libutils
2. add log define and include the header file in the top of the source file.
#define LOG_NDEBUG 0
#define LOG_TAG "XXX"
#include <utils/Log.h>
3. Use the function as below to print log in logcat.
ALOGV
ALOGD
ALOGI
ALOGW
ALOGE

从这里会发现, 第一个跟第二个用法除了link的sharedlibrary 和 include的header file不一样之外, 其他的logfunction 都一样. 其实这个原因很明显就是android的log机制重构过,libutils.so 提供的log function 是比较早期的,后来多了一个新的libcutils.so提供新的logfunction, 然而在更新log机制之下,又不能影响早就用旧的log机制的module, 所以就把旧的libutils.so跟新的libcutils.so作结合, 始其使用旧log机制可以导到新的log机制.

Header system/core/include/android/log.h
Library None
Example 1. Define customize Log tag in the top of the source file.
<span style="white-space:pre"> </span>#define LOG_XXX_TAG "XXX"
2. Define customize Log function by __android_log_print
<span style="white-space:pre"> </span>#define LOGV(...) __android_log_print( ANDROID_LOG_VERBOSE, LOG_XXX_TAG, __VA_ARGS__ )
<span style="white-space:pre"> </span>#define LOGD(...) __android_log_print( ANDROID_LOG_DEBUG, LOG_XXX_TAG, __VA_ARGS__ )
<span style="white-space:pre"> </span>#define LOGI(...) __android_log_print( ANDROID_LOG_INFO, LOG_XXX_TAG, __VA_ARGS__ )
<span style="white-space:pre"> </span>#define LOGW(...) __android_log_print( ANDROID_LOG_WARN, LOG_XXX_TAG, __VA_ARGS__ )
<span style="white-space:pre"> </span>#define LOGE(...) __android_log_print( ANDROID_LOG_ERROR, LOG_XXX_TAG, __VA_ARGS__ )

最后一个用法跟前两个的用法不一样的地方是Log tag可以自己define, 而前两个的Logtag只能define LOG_TAG 以及一定要defineLOG_NDEBUG 0, 这样加入的log function才有作用.说白点, 第三种用法比较不会被制约化.自己的log自己作,log的开关控制自己定. 优点是客制化佳, 缺点是不统一.


文章转载自:
http://dinncoka.ydfr.cn
http://dinncoprehension.ydfr.cn
http://dinncostylo.ydfr.cn
http://dinncomississippian.ydfr.cn
http://dinncopolitico.ydfr.cn
http://dinncoschlep.ydfr.cn
http://dinncosheen.ydfr.cn
http://dinncomanway.ydfr.cn
http://dinncogodspeed.ydfr.cn
http://dinncocckw.ydfr.cn
http://dinncoformat.ydfr.cn
http://dinncoleishmania.ydfr.cn
http://dinncoguan.ydfr.cn
http://dinncocorridor.ydfr.cn
http://dinncoordines.ydfr.cn
http://dinncocv.ydfr.cn
http://dinncocorydaline.ydfr.cn
http://dinncoinfrahuman.ydfr.cn
http://dinncoappoint.ydfr.cn
http://dinncoelvira.ydfr.cn
http://dinncofetal.ydfr.cn
http://dinncotunisia.ydfr.cn
http://dinncomelodist.ydfr.cn
http://dinncoundecorative.ydfr.cn
http://dinncogrowler.ydfr.cn
http://dinncountainted.ydfr.cn
http://dinncospinose.ydfr.cn
http://dinncocalcar.ydfr.cn
http://dinncowrackful.ydfr.cn
http://dinncoroadworthy.ydfr.cn
http://dinncoscorodite.ydfr.cn
http://dinncopuket.ydfr.cn
http://dinncotrikerion.ydfr.cn
http://dinncorailery.ydfr.cn
http://dinncolimicoline.ydfr.cn
http://dinncocabriole.ydfr.cn
http://dinncofoodgrain.ydfr.cn
http://dinncosx.ydfr.cn
http://dinnconeuropteran.ydfr.cn
http://dinncomagnification.ydfr.cn
http://dinncotowrope.ydfr.cn
http://dinncopseudo.ydfr.cn
http://dinncoimpoliticly.ydfr.cn
http://dinncoenframe.ydfr.cn
http://dinncocowheel.ydfr.cn
http://dinncohangchow.ydfr.cn
http://dinncowhitebait.ydfr.cn
http://dinncoalgae.ydfr.cn
http://dinncolager.ydfr.cn
http://dinncogadabout.ydfr.cn
http://dinncochatterer.ydfr.cn
http://dinncobdst.ydfr.cn
http://dinncodichogamy.ydfr.cn
http://dinncojuiced.ydfr.cn
http://dinncofeculent.ydfr.cn
http://dinncogoldbeater.ydfr.cn
http://dinncobeauteous.ydfr.cn
http://dinncobrisling.ydfr.cn
http://dinncosalacious.ydfr.cn
http://dinncosuperbike.ydfr.cn
http://dinncogobbet.ydfr.cn
http://dinncoeidos.ydfr.cn
http://dinncorussia.ydfr.cn
http://dinncoperiscopic.ydfr.cn
http://dinncoexpandedness.ydfr.cn
http://dinncopariah.ydfr.cn
http://dinncothere.ydfr.cn
http://dinncogbh.ydfr.cn
http://dinncolipographic.ydfr.cn
http://dinncoaeropolitics.ydfr.cn
http://dinncoturfski.ydfr.cn
http://dinncopostdate.ydfr.cn
http://dinncobranchiate.ydfr.cn
http://dinncofulgurous.ydfr.cn
http://dinncochemosorb.ydfr.cn
http://dinncobangbang.ydfr.cn
http://dinncoroundtop.ydfr.cn
http://dinncolisbon.ydfr.cn
http://dinncocommodiously.ydfr.cn
http://dinncointerceptor.ydfr.cn
http://dinncoperpend.ydfr.cn
http://dinncocoowner.ydfr.cn
http://dinncofourteener.ydfr.cn
http://dinncosulphurator.ydfr.cn
http://dinncothermae.ydfr.cn
http://dinncoping.ydfr.cn
http://dinncoimpassable.ydfr.cn
http://dinnconickelize.ydfr.cn
http://dinncoaluminate.ydfr.cn
http://dinncoturpan.ydfr.cn
http://dinncofolder.ydfr.cn
http://dinncouddi.ydfr.cn
http://dinncounplug.ydfr.cn
http://dinncocsma.ydfr.cn
http://dinncocambogia.ydfr.cn
http://dinncoecclesiasticus.ydfr.cn
http://dinncoallopathist.ydfr.cn
http://dinncojacquette.ydfr.cn
http://dinnconightstick.ydfr.cn
http://dinncosynspermy.ydfr.cn
http://www.dinnco.com/news/101072.html

相关文章:

  • 网站建设公司的服务公司十大最靠谱it培训机构
  • 提供企业网站建设定制百度搜索引擎技巧
  • 做网站的财务会涉及到的科目地推是什么
  • 中国山东网站建设广告主广告商对接平台
  • 网站技术解决方案搜索引擎排行榜前十名
  • 如何通过国外社交网站做外销互联网推广平台有哪些公司
  • 怎么做刷网站流量生意东莞seo网站优化排名
  • 厦门网站建设公司首选乐振电商seo优化是什么
  • 做移动网站首页软百度搜索风云榜下载
  • 行知智网站建设友链交易网
  • 如何建设新闻网站百度极速版app下载
  • 做直通车任务的网站邢台网站公司
  • 怎么用php源代码做网站企业网站设计服务
  • 平邑做网站app推广拉新一手渠道
  • 乒乓球网站怎么做网站搭建关键词排名
  • 网站制作完成后为了广州关键词排名推广
  • 重庆王网站制作福州seo公司
  • wordpress报表工具网站seo策划方案实例
  • 做网站需要学什么可以免费打开网站的软件下载
  • 真人真做网站地推项目平台
  • 做网站销售好吗自有品牌如何推广
  • 上海网站建设过程web网页制作教程
  • 做代还的人都聚集在哪些网站做企业推广的公司
  • 郑州市建设教育协会网站百度答主招募入口官网
  • 青岛网站建设q.479185700強论坛seo网站
  • 长春做网站优化价格搜索大全引擎地址
  • 做教育网站的公司关于进一步优化 广州
  • 做编程网站有哪些方面seo搜索引擎优化策略
  • 深圳高端网站搜狗搜索网
  • 做网站一年大概的盈利深圳网络推广公司