use of com.luastar.swift.tools.view.GuiLoggerAppender in project swift by luastar.
the class MainController method initConsoleTextArea.
/**
* 初始化控制台
*/
private void initConsoleTextArea() {
// 不可编辑
consoleTextArea.setEditable(false);
// 右键清除按钮
MenuItem clear = new MenuItem("清除");
clear.setOnAction(event -> consoleTextArea.clear());
ContextMenu contextMenu = new ContextMenu();
contextMenu.getItems().add(clear);
consoleTextArea.setContextMenu(contextMenu);
// 设置日志属性
Logger rootLogger = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
Appender<ILoggingEvent> appender = rootLogger.getAppender("gui");
if (appender != null && (appender instanceof GuiLoggerAppender)) {
((GuiLoggerAppender) appender).setConsoleTextArea(consoleTextArea);
}
}
Aggregations