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

30天网站建设实录视频云盘搜索李晓峰

30天网站建设实录视频云盘,搜索李晓峰,h5网站建设功能计划表,那些提卡网站是怎么做的一 .logcat命令介绍 android log系统: logcat介绍 : logcat是android中的一个命令行工具,可以用于得到程序的log信息. 二.C/Clogcat访问接口 Android系统中的C/C日志接口是通过宏来使用的。在system/core/include/android/log.h定义了日志的级别: /…

一 .logcat命令介绍

android log系统:

logcat介绍 :

logcat是android中的一个命令行工具,可以用于得到程序的log信息.

二.C/C++logcat访问接口

Android系统中的C/C++日志接口是通过宏来使用的。在system/core/include/android/log.h定义了日志的级别:

/** Android log priority values, in ascending priority order.*/
typedef enum android_LogPriority {ANDROID_LOG_UNKNOWN = 0,ANDROID_LOG_DEFAULT,	/* only for SetMinPriority() */ANDROID_LOG_VERBOSE,ANDROID_LOG_DEBUG,ANDROID_LOG_INFO,ANDROID_LOG_WARN,ANDROID_LOG_ERROR,ANDROID_LOG_FATAL,ANDROID_LOG_SILENT,	/* only for SetMinPriority(); must be last */
} android_LogPriority;

在system/core/include/cutils/log.h中,定义了对应的宏,如对应于ANDROID_LOG_VERBOSE的宏LOGV:

/** This is the local tag used for the following simplified* logging macros. You can change this preprocessor definition* before using the other macros to change the tag.*/
#ifndef LOG_TAG
#define LOG_TAG NULL
#endif/** Simplified macro to send a verbose log message using the current LOG_TAG.*/
#ifndef LOGV
#if LOG_NDEBUG
#define LOGV(...)   ((void)0)
#else
#define LOGV(...)   ((void)LOG(LOG_VERBOSE, LOG_TAG, __VA_ARGS__))
#endif
#endif/** Basic log message macro.** Example:*  LOG(LOG_WARN, NULL, "Failed with error %d", errno);** The second argument may be NULL or "" to indicate the "global" tag.*/
#ifndef LOG
#define LOG(priority, tag, ...) \LOG_PRI(ANDROID_##priority, tag, __VA_ARGS__)
#endif/** Log macro that allows you to specify a number for priority.*/
#ifndef LOG_PRI
#define LOG_PRI(priority, tag, ...) \android_printLog(priority, tag, __VA_ARGS__)
#endif/** ================================================================** The stuff in the rest of this file should not be used directly.*/
#define android_printLog(prio, tag, fmt...) \__android_log_print(prio, tag, fmt)

  因此,如果要使用C/C++日志接口,只要定义自己的LOG_TAG宏和包含头文件system/core/include/cutils/log.h就可以了:

 #define LOG_TAG "MY LOG TAG"

         #include <cutils/log.h>

         就可以了,例如使用LOGV:

         LOGV("This is the log printed by LOGV in android user space.");

三.Java logcat访问接口

Android系统在Frameworks层中定义了Log接口(frameworks/base/core/java/android/util/Log.java):

................................................public final class Log {................................................/*** Priority constant for the println method; use Log.v.*/public static final int VERBOSE = 2;/*** Priority constant for the println method; use Log.d.*/public static final int DEBUG = 3;/*** Priority constant for the println method; use Log.i.*/public static final int INFO = 4;/*** Priority constant for the println method; use Log.w.*/public static final int WARN = 5;/*** Priority constant for the println method; use Log.e.*/public static final int ERROR = 6;/*** Priority constant for the println method.*/public static final int ASSERT = 7;.....................................................public static int v(String tag, String msg) {return println_native(LOG_ID_MAIN, VERBOSE, tag, msg);}public static int v(String tag, String msg, Throwable tr) {return println_native(LOG_ID_MAIN, VERBOSE, tag, msg + '\n' + getStackTraceString(tr));}public static int d(String tag, String msg) {return println_native(LOG_ID_MAIN, DEBUG, tag, msg);}public static int d(String tag, String msg, Throwable tr) {return println_native(LOG_ID_MAIN, DEBUG, tag, msg + '\n' + getStackTraceString(tr));}public static int i(String tag, String msg) {return println_native(LOG_ID_MAIN, INFO, tag, msg);}public static int i(String tag, String msg, Throwable tr) {return println_native(LOG_ID_MAIN, INFO, tag, msg + '\n' + getStackTraceString(tr));}public static int w(String tag, String msg) {return println_native(LOG_ID_MAIN, WARN, tag, msg);}public static int w(String tag, String msg, Throwable tr) {return println_native(LOG_ID_MAIN, WARN, tag, msg + '\n' + getStackTraceString(tr));}public static int w(String tag, Throwable tr) {return println_native(LOG_ID_MAIN, WARN, tag, getStackTraceString(tr));}public static int e(String tag, String msg) {return println_native(LOG_ID_MAIN, ERROR, tag, msg);}public static int e(String tag, String msg, Throwable tr) {return println_native(LOG_ID_MAIN, ERROR, tag, msg + '\n' + getStackTraceString(tr));}................................................................../**@hide */ public static native int println_native(int bufID,int priority, String tag, String msg);
}

因此,如果要使用Java日志接口,只要在类中定义的LOG_TAG常量和引用android.util.Log就可以了:

        private static final String LOG_TAG = "MY_LOG_TAG";

        Log.i(LOG_TAG, "This is the log printed by Log.i in android user space.");

四.logcat命令参数

参数

描述

-b <buffer>加载一个可使用的日志缓冲区供查看,比如event和radio。默认值是main
-c清除缓冲区中的全部日志并退出(清除完后可以使用-g查看缓冲区)
-d将缓冲区的log转存到屏幕中然后退出
-f <filename>将log输出到指定的文件中<文件名>.默认为标准输出(stdout)
-g打印日志缓冲区的大小并退出
-n <count>设置日志的最大数目<count>,默认值是4,需要和-r选项一起使用
-r <kbytes>没<kbytes>时输出日志,默认值是16,需要和-f选项一起使用
-s设置过滤器
-v <format>设置输出格式的日志消息。默认是短暂的格式。支持的格式列表
//将缓冲区的log打印到屏幕并退出adb logcat -d//清除缓冲区log(testCase运行前可以先清除一下)adb logcat -c//打印缓冲区大小并退出adb logcat -g//输出logadb logcat -f /data/local/tmp/log.txt -n 10 -r 1

http://www.yayakq.cn/news/398666/

相关文章:

  • 微信公众号php网站开发oa办公系统软件
  • 阿里云网站备案幕布比较有名的编程培训机构
  • 足球直播网站怎么做wordpress设置前台投稿
  • 北京华夏网站建设设计公司房产网站系统源码
  • 智慧景区网站服务建设十大互联网平台
  • 网站建设一般用什么语言浏览器加速器免费版
  • 个人做排行网站太原电商网站设计
  • 上海网站搜索排名优化哪家好英文网站建设方案详细方案
  • 天津做网站选择津坤科技c多语言网站多域名推广
  • 想要学做网站打造网站品牌
  • 景点网站建设方案做网站需要准备的东西
  • 外包服务有限公司怎么seo网站关键词优化
  • 微网站一键通话深圳建设外贸网站
  • 廊坊百度快照优化排名长沙网站seo诊断
  • 服装店网站模板安徽建设厅网站考勤
  • 卖东西的网站有哪些板绘网课平台哪个好
  • 河北省建设厅注册中心网站首页代运营公司介绍
  • 相亲网站用什么做的怎么建网站数据库
  • 临沂做网站推广的公司有wordpress 邮件设置
  • 用 net做网站广水网站设计
  • 物流炒货怎么做网站南安市住房和城乡建设局网站
  • 北京网站建设代理律师网站 扁平化
  • 做美食软件视频网站有哪些腾讯云网站建设视频
  • 网站设计属于什么经营范围中国亚马逊网站建设
  • 天津网站建设开发离婚在线律师
  • .jsp网站开发技术网络推广引流是什么意思
  • 怎么用一级域名搭建网站开一个网站_只做同城交易
  • 初学网站建设电商网站建设选迅法网
  • 做网站 备案wordpress 幻灯片手机端字体大小
  • 大足区城乡建设投资集团网站广告艺术设计是什么