public class EventLog
extends Object
| java.lang.Object | |
| android.util.EventLog | |
访问系统诊断事件记录。 系统诊断事件用于记录某些系统级事件(例如垃圾收集,活动管理器状态,系统监视程序和其他低级别活动),这些事件可能会在系统开发期间自动收集和分析。
这不是主要的“logcat”调试日志( Log )! 这些诊断事件适用于系统集成商,而不是应用程序作者。
事件使用对应于/ system / etc / event-log-tags的整数标记代码。 它们携带一个或多个int,long或String值的有效内容。 事件日志标签文件定义每种类型代码的有效载荷内容。
Nested classes |
|
|---|---|
class |
EventLog.Event 从日志中读取先前记录的事件。 |
公共方法(Public methods) |
|
|---|---|
static int |
getTagCode(String name) 获取与事件名称关联的事件类型标记代码。 |
static String |
getTagName(int tag) 获取与事件类型标记代码关联的名称。 |
static void |
readEvents(int[] tags, Collection<EventLog.Event> output) 从日志中读取事件,按类型过滤。 |
static int |
writeEvent(int tag, String str) 记录事件日志消息。 |
static int |
writeEvent(int tag, Object... list) 记录事件日志消息。 |
static int |
writeEvent(int tag, int value) 记录事件日志消息。 |
static int |
writeEvent(int tag, float value) 记录事件日志消息。 |
static int |
writeEvent(int tag, long value) 记录事件日志消息。 |
继承方法(Inherited methods) |
|
|---|---|
java.lang.Object
|
|
int getTagCode (String name)
获取与事件名称关联的事件类型标记代码。
| 参数(Parameters) | |
|---|---|
name |
String: of event to look up |
| 返回(Returns) | |
|---|---|
int |
the tag code, or -1 if no tag has that name |
String getTagName (int tag)
获取与事件类型标记代码关联的名称。
| 参数(Parameters) | |
|---|---|
tag |
int: code to look up |
| 返回(Returns) | |
|---|---|
String |
the name of the tag, or null if no tag has that number |
void readEvents (int[] tags,
Collection<EventLog.Event> output)
从日志中读取事件,按类型过滤。
| 参数(Parameters) | |
|---|---|
tags |
int: to search for |
output |
Collection: container to add events into |
| 抛出异常(Throws) | |
|---|---|
IOException |
if something goes wrong reading events |
int writeEvent (int tag,
String str)
记录事件日志消息。
| 参数(Parameters) | |
|---|---|
tag |
int: The event type tag code |
str |
String: A value to log |
| 返回(Returns) | |
|---|---|
int |
The number of bytes written |
int writeEvent (int tag,
Object... list)
记录事件日志消息。
| 参数(Parameters) | |
|---|---|
tag |
int: The event type tag code |
list |
Object: A list of values to log |
| 返回(Returns) | |
|---|---|
int |
The number of bytes written |
int writeEvent (int tag,
int value)
记录事件日志消息。
| 参数(Parameters) | |
|---|---|
tag |
int: The event type tag code |
value |
int: A value to log |
| 返回(Returns) | |
|---|---|
int |
The number of bytes written |
int writeEvent (int tag,
float value)
记录事件日志消息。
| 参数(Parameters) | |
|---|---|
tag |
int: The event type tag code |
value |
float: A value to log |
| 返回(Returns) | |
|---|---|
int |
The number of bytes written |
int writeEvent (int tag,
long value)
记录事件日志消息。
| 参数(Parameters) | |
|---|---|
tag |
int: The event type tag code |
value |
long: A value to log |
| 返回(Returns) | |
|---|---|
int |
The number of bytes written |