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


Java Level.equals方法代码示例

本文整理汇总了Java中java.util.logging.Level.equals方法的典型用法代码示例。如果您正苦于以下问题:Java Level.equals方法的具体用法?Java Level.equals怎么用?Java Level.equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.logging.Level的用法示例。


在下文中一共展示了Level.equals方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processWebDriverLogs

import java.util.logging.Level; //导入方法依赖的package包/类
private void processWebDriverLogs(WebDriver webDriver) {
    Logs logs = webDriver.manage().logs();
    for (String logType : WEBDRIVER_LOG_LEVELS.keySet()) {
        LOGGER.info("Dumping webdriver log for log type " + logType);
        LogEntries logEntries = logs.get(logType);
        for (LogEntry logEntry : logEntries) {
            String formattedOriginalTimestamp = LOG_TIMESTAMP_FORMAT
                    .format(LocalDateTime.ofInstant(Instant.ofEpochMilli(logEntry.getTimestamp()), ZoneOffset.UTC));
            Level logEntryLevel = logEntry.getLevel();
            if (logEntryLevel.equals(Level.FINE)) {
                LOGGER.debug(MESSAGE_PATTERN, logType, formattedOriginalTimestamp, logEntry.getMessage());
            } else if (logEntryLevel.equals(Level.INFO)) {
                LOGGER.info(MESSAGE_PATTERN, logType, formattedOriginalTimestamp, logEntry.getMessage());
            } else if (logEntryLevel.equals(Level.WARNING)) {
                LOGGER.warn(MESSAGE_PATTERN, logType, formattedOriginalTimestamp, logEntry.getMessage());
            } else if (logEntryLevel.equals(Level.SEVERE)) {
                LOGGER.error(MESSAGE_PATTERN, logType, formattedOriginalTimestamp, logEntry.getMessage());
            } else if (logEntryLevel.equals(Level.FINER)) {
                LOGGER.trace(MESSAGE_PATTERN, logType, formattedOriginalTimestamp, logEntry.getMessage());
            }
        }
    }
}
 
开发者ID:willhaben,项目名称:willtest,代码行数:24,代码来源:WebDriverLog.java

示例2: LogLevelMenu

import java.util.logging.Level; //导入方法依赖的package包/类
public LogLevelMenu() {
	super("log_level");

	for (final Level level : LogViewer.SELECTABLE_LEVELS) {
		JMenuItem item = new JMenuItem(new AbstractAction(level.getName()) {

			private static final long serialVersionUID = 1L;

			@Override
			public void actionPerformed(ActionEvent e) {
				new Thread(new Runnable() {

					@Override
					public void run() {
						// change the log level outside the EDT
						// no progress thread because the part that may take some time (the
						// GUI refresh by Swing) cannot be cancelled anyway
						setLogLevel(level);
					}
				}).start();
			}
		});

		// highlight current log level
		if (getLogSelectionModel().getCurrentLogModel() != null) {
			if (level.equals(getLogSelectionModel().getCurrentLogModel().getLogLevel())) {
				item.setFont(item.getFont().deriveFont(Font.BOLD));
			}
		}
		add(item);
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:33,代码来源:LogViewer.java

示例3: log

import java.util.logging.Level; //导入方法依赖的package包/类
public boolean log(Level level, String message, Exception exception) {
    if (message != null || exception != null) {
        StringBuilder builder = new StringBuilder();
        if (message != null) {
            builder.append(message);
        }

        if (message != null && exception != null) {
            builder.append("\n");
        }

        if (exception != null) {
            StringWriter writer = new StringWriter();
            exception.printStackTrace(new PrintWriter(writer));

            builder.append(writer.toString());
        }

        logger.log(level, builder.toString());

        Object exit = state.getProperty(ConsoleEvent.EXIT_ON_SEVERE);
        if (exit != null && exit.equals(true) && level.equals(Level.SEVERE)) {
            System.exit(0);
        }
        return true;
    } else {
        return false;
    }
}
 
开发者ID:Meticuli-Technologies,项目名称:Nexus,代码行数:30,代码来源:Console.java

示例4: findRecord

import java.util.logging.Level; //导入方法依赖的package包/类
public LogRecord findRecord(Level level, String message) {
	synchronized (records) {
		for (LogRecord r : records) {
			if (level.equals(r.getLevel()) && message.equals(r.getMessage()))
				return r;
		}
		return null;
	}
}
 
开发者ID:tracymiranda,项目名称:dsp4e,代码行数:10,代码来源:LogMessageAccumulator.java


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