本文整理汇总了Java中com.android.ddmlib.Log.LogLevel类的典型用法代码示例。如果您正苦于以下问题:Java LogLevel类的具体用法?Java LogLevel怎么用?Java LogLevel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LogLevel类属于com.android.ddmlib.Log包,在下文中一共展示了LogLevel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadLog
import com.android.ddmlib.Log.LogLevel; //导入依赖的package包/类
/**
* Loads a binary event log (if has associated .tag file) or
* otherwise loads a textual event log.
* @param filePath Event log path (and base of potential tag file)
*/
public void loadLog(String filePath) {
if ((new File(filePath + TAG_FILE_EXT)).exists()) {
startEventLogFromFiles(filePath);
} else {
try {
EventLogImporter importer = new EventLogImporter(filePath);
String[] tags = importer.getTags();
String[] log = importer.getLog();
startEventLogFromContent(tags, log);
} catch (FileNotFoundException e) {
// If this fails, display the error message from startEventLogFromFiles,
// and pretend we never tried EventLogImporter
Log.logAndDisplay(Log.LogLevel.ERROR, "EventLog",
String.format("Failure to read %1$s", filePath + TAG_FILE_EXT));
}
}
}
示例2: LogFilterDialog
import com.android.ddmlib.Log.LogLevel; //导入依赖的package包/类
/**
* Creates new form LogFilterDialog
*/
public LogFilterDialog() {
super((java.awt.Frame) null, true);
initComponents();
DefaultComboBoxModel<LogLevel> model = new DefaultComboBoxModel<>();
model.addElement(null);
model.addElement(LogLevel.ASSERT);
model.addElement(LogLevel.VERBOSE);
model.addElement(LogLevel.DEBUG);
model.addElement(LogLevel.INFO);
model.addElement(LogLevel.WARN);
model.addElement(LogLevel.ERROR);
cmbLogLevel.setRenderer(new LogLevelListRenderer());
cmbLogLevel.setModel(model);
getRootPane().setDefaultButton(butOk);
}
示例3: LogFilter
import com.android.ddmlib.Log.LogLevel; //导入依赖的package包/类
public LogFilter(String name, String filterTag, String filterProcess, LogLevel filterLevel) {
this.name = name;
this.filterTag = filterTag;
this.filterLevel = filterLevel;
this.filterProcess = filterProcess;
if (filterProcess == null) {
this.filterPid = -1;
} else {
int pid = -1;
try {
pid = Integer.parseInt(filterProcess);
} catch (NumberFormatException e) {
}
this.filterPid = pid;
}
}
示例4: deserialize
import com.android.ddmlib.Log.LogLevel; //导入依赖的package包/类
/**
* Create a new filter, which was previously stored in the given properties
* list.
*/
public static LogFilter deserialize(Properties p, String prefix) {
String name = p.getProperty(prefix + "." + SERIALIZE_NAME);
String process = p.getProperty(prefix + "." + SERIALIZE_PROCESS);
String tag = p.getProperty(prefix + "." + SERIALIZE_TAG);
String lvlname = p.getProperty(prefix + "." + SERIALIZE_LEVEL);
LogLevel level = null;
if (lvlname != null) {
try {
level = LogLevel.valueOf(lvlname);
} catch (IllegalArgumentException e) {
}
}
if (name != null) {
return new LogFilter(name, tag, process, level);
}
return null;
}
示例5: getColumnClass
import com.android.ddmlib.Log.LogLevel; //导入依赖的package包/类
@Override
public Class<?> getColumnClass(int columnIndex) {
switch (columnIndex) {
case COL_MESSAGE:
return String.class;
case COL_PID:
return Integer.class;
case COL_PROCESS:
return String.class;
case COL_TIME:
return String.class; // TODO(radim): how to sort this properly
case COL_TAG:
return String.class;
case COL_LEVEL:
return LogLevel.class;
}
throw new IllegalArgumentException("This column does not exist: " + columnIndex);
}
示例6: LogCatMessage
import com.android.ddmlib.Log.LogLevel; //导入依赖的package包/类
/**
* Construct an immutable log message object.
*/
public LogCatMessage(@NonNull LogLevel logLevel, @NonNull String pid, @NonNull String tid,
@NonNull String appName, @NonNull String tag,
@NonNull String time, @NonNull String msg) {
mLogLevel = logLevel;
mPid = pid;
mAppName = appName;
mTag = tag;
mTime = time;
mMessage = msg;
long tidValue;
try {
// Thread id's may be in hex on some platforms.
// Decode and store them in radix 10.
tidValue = Long.decode(tid.trim());
} catch (NumberFormatException e) {
tidValue = -1;
}
mTid = Long.toString(tidValue);
}
示例7: LogCatMessage
import com.android.ddmlib.Log.LogLevel; //导入依赖的package包/类
/**
* Construct an immutable log message object.
*/
public LogCatMessage(LogLevel logLevel, String pid, String tid, String appName,
String tag, String time, String msg) {
mLogLevel = logLevel;
mPid = pid;
mAppName = appName;
mTag = tag;
mTime = time;
mMessage = msg;
long tidValue;
try {
// Thread id's may be in hex on some platforms.
// Decode and store them in radix 10.
tidValue = Long.decode(tid.trim());
} catch (NumberFormatException e) {
tidValue = -1;
}
mTid = Long.toString(tidValue);
}
示例8: addNewFilter
import com.android.ddmlib.Log.LogLevel; //导入依赖的package包/类
private void addNewFilter(String defaultTag, String defaultText, String defaultPid,
String defaultAppName, LogLevel defaultLevel) {
LogCatFilterSettingsDialog d = new LogCatFilterSettingsDialog(
Display.getCurrent().getActiveShell());
d.setDefaults("", defaultTag, defaultText, defaultPid, defaultAppName, defaultLevel);
if (d.open() != Window.OK) {
return;
}
LogCatFilter f = new LogCatFilter(d.getFilterName().trim(),
d.getTag().trim(),
d.getText().trim(),
d.getPid().trim(),
d.getAppName().trim(),
LogLevel.getByString(d.getLogLevel()));
mLogCatFilters.add(f);
mFiltersTableViewer.refresh();
/* select the newly added entry */
int idx = mLogCatFilters.size() - 1;
mFiltersTableViewer.getTable().setSelection(idx);
filterSelectionChanged();
saveFilterPreferences();
}
示例9: getForegroundColor
import com.android.ddmlib.Log.LogLevel; //导入依赖的package包/类
private Color getForegroundColor(LogCatMessage m) {
LogLevel l = m.getLogLevel();
if (l.equals(LogLevel.VERBOSE)) {
return mVerboseColor;
} else if (l.equals(LogLevel.INFO)) {
return mInfoColor;
} else if (l.equals(LogLevel.DEBUG)) {
return mDebugColor;
} else if (l.equals(LogLevel.ERROR)) {
return mErrorColor;
} else if (l.equals(LogLevel.WARN)) {
return mWarnColor;
} else if (l.equals(LogLevel.ASSERT)) {
return mAssertColor;
}
return mVerboseColor;
}
示例10: addTableItem
import com.android.ddmlib.Log.LogLevel; //导入依赖的package包/类
/**
* Add a TableItem for the index-th item of the buffer
* @param filter The index of the table in which to insert the item.
*/
private void addTableItem(LogMessage msg) {
TableItem item = new TableItem(mTable, SWT.NONE);
item.setText(0, msg.data.time);
item.setText(1, new String(new char[] { msg.data.logLevel.getPriorityLetter() }));
item.setText(2, msg.data.pidString);
item.setText(3, msg.data.tag);
item.setText(4, msg.msg);
// add the buffer index as data
item.setData(msg);
if (msg.data.logLevel == LogLevel.INFO) {
item.setForeground(mColors.infoColor);
} else if (msg.data.logLevel == LogLevel.DEBUG) {
item.setForeground(mColors.debugColor);
} else if (msg.data.logLevel == LogLevel.ERROR) {
item.setForeground(mColors.errorColor);
} else if (msg.data.logLevel == LogLevel.WARN) {
item.setForeground(mColors.warningColor);
} else {
item.setForeground(mColors.verboseColor);
}
}
示例11: testLog
import com.android.ddmlib.Log.LogLevel; //导入依赖的package包/类
@Test
public void testLog() throws InterruptedException {
AndroidDevice device = pollFirst();
final LogCatFilter filter = new LogCatFilter("", "", "com.android", "",
"", LogLevel.WARN);
final LogCatListener lcl = new LogCatListener() {
@Override
public void log(List<LogCatMessage> msgList) {
for (LogCatMessage msg : msgList) {
if (filter.matches(msg)) {
System.out.println(msg);
}
}
}
};
device.addLogCatListener(lcl);
Thread.sleep(50000000);
}
示例12: testLogcat
import com.android.ddmlib.Log.LogLevel; //导入依赖的package包/类
@Test
public void testLogcat() throws InterruptedException {
AndroidDevice device = getDevices().pollFirst();
final LogCatFilter filter = new LogCatFilter("", "", "com.android", "",
"", LogLevel.WARN);
final LogCatListener lcl = new LogCatListener() {
@Override
public void log(List<LogCatMessage> msgList) {
for (LogCatMessage msg : msgList) {
if (filter.matches(msg)) {
System.out.println(msg);
}
}
}
};
device.addLogCatListener(lcl);
Thread.sleep(60000);
}
示例13: addNewFilter
import com.android.ddmlib.Log.LogLevel; //导入依赖的package包/类
private void addNewFilter() {
LogCatFilterSettingsDialog d = new LogCatFilterSettingsDialog(
Display.getCurrent().getActiveShell());
if (d.open() != Window.OK) {
return;
}
LogCatFilter f = new LogCatFilter(d.getFilterName().trim(),
d.getTag().trim(),
d.getText().trim(),
d.getPid().trim(),
d.getAppName().trim(),
LogLevel.getByString(d.getLogLevel()));
mLogCatFilters.add(f);
mFiltersTableViewer.refresh();
/* select the newly added entry */
int idx = mLogCatFilters.size() - 1;
mFiltersTableViewer.getTable().setSelection(idx);
filterSelectionChanged();
saveFilterPreferences();
}
示例14: getForegroundColor
import com.android.ddmlib.Log.LogLevel; //导入依赖的package包/类
private Color getForegroundColor(LogCatMessage m) {
LogLevel l = m.getLogLevel();
if (l.equals(LogLevel.VERBOSE)) {
return VERBOSE_MSG_COLOR;
} else if (l.equals(LogLevel.INFO)) {
return INFO_MSG_COLOR;
} else if (l.equals(LogLevel.DEBUG)) {
return DEBUG_MSG_COLOR;
} else if (l.equals(LogLevel.ERROR)) {
return ERROR_MSG_COLOR;
} else if (l.equals(LogLevel.WARN)) {
return WARN_MSG_COLOR;
}
return null;
}
示例15: LogEventInfo
import com.android.ddmlib.Log.LogLevel; //导入依赖的package包/类
public LogEventInfo(int pid, String[] pNameRef, String time, String tag, LogLevel level) {
this.pid = pid;
this.pNameRef = pNameRef;
this.time = time;
this.tag = tag;
this.level = level;
}