当前位置: 首页>>代码示例>>Java>>正文


Java LogLevel类代码示例

本文整理汇总了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));
        }

    }
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:24,代码来源:EventLogPanel.java

示例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);
}
 
开发者ID:NBANDROIDTEAM,项目名称:NBANDROID-V2,代码行数:22,代码来源:LogFilterDialog.java

示例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;
    }
}
 
开发者ID:NBANDROIDTEAM,项目名称:NBANDROID-V2,代码行数:20,代码来源:LogFilter.java

示例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;
}
 
开发者ID:NBANDROIDTEAM,项目名称:NBANDROID-V2,代码行数:25,代码来源:LogFilter.java

示例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);
}
 
开发者ID:NBANDROIDTEAM,项目名称:NBANDROID-V2,代码行数:19,代码来源:LogTableModel.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:LogCatMessage.java

示例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);
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:24,代码来源:LogCatMessage.java

示例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();
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:27,代码来源:LogCatPanel.java

示例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;
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:20,代码来源:LogCatPanel.java

示例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);
    }
}
 
开发者ID:utds3lab,项目名称:SMVHunter,代码行数:28,代码来源:LogFilter.java

示例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);
}
 
开发者ID:cosysoft,项目名称:device,代码行数:22,代码来源:LogcatTest.java

示例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);
}
 
开发者ID:cosysoft,项目名称:device,代码行数:22,代码来源:Readme.java

示例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();
}
 
开发者ID:lrscp,项目名称:ControlAndroidDeviceFromPC,代码行数:25,代码来源:LogCatPanel.java

示例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;
}
 
开发者ID:lrscp,项目名称:ControlAndroidDeviceFromPC,代码行数:18,代码来源:LogCatMessageLabelProvider.java

示例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;
}
 
开发者ID:NBANDROIDTEAM,项目名称:NBANDROID-V2,代码行数:8,代码来源:LogEventInfo.java


注:本文中的com.android.ddmlib.Log.LogLevel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。