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