Remove News and Logging tab
This commit is contained in:
parent
a19c6e2794
commit
4b7f1f8057
|
@ -39,10 +39,8 @@ import ctbrec.sites.stripchat.Stripchat;
|
|||
import ctbrec.sites.winktv.WinkTv;
|
||||
import ctbrec.sites.xlovecam.XloveCam;
|
||||
import ctbrec.ui.controls.Dialogs;
|
||||
import ctbrec.ui.news.NewsTab;
|
||||
import ctbrec.ui.settings.SettingsTab;
|
||||
import ctbrec.ui.tabs.*;
|
||||
import ctbrec.ui.tabs.logging.LoggingTab;
|
||||
import ctbrec.ui.tabs.recorded.RecordedTab;
|
||||
import javafx.application.Application;
|
||||
import javafx.application.HostServices;
|
||||
|
@ -258,10 +256,8 @@ public class CamrecApplication extends Application {
|
|||
tabPane.getTabs().add(new RecentlyWatchedTab(recorder, sites));
|
||||
}
|
||||
tabPane.getTabs().add(new SettingsTab(sites, recorder));
|
||||
tabPane.getTabs().add(new NewsTab(config));
|
||||
tabPane.getTabs().add(new DonateTabFx());
|
||||
tabPane.getTabs().add(new HelpTab());
|
||||
tabPane.getTabs().add(new LoggingTab());
|
||||
tabPane.setTabDragPolicy(config.getSettings().tabsSortable ? REORDER : FIXED);
|
||||
|
||||
restoreTabOrder();
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
package ctbrec.ui.news;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class Account {
|
||||
|
||||
@JsonProperty("emojis")
|
||||
private List<Object> emojis = null;
|
||||
@JsonProperty("note")
|
||||
private String note;
|
||||
@JsonProperty("bot")
|
||||
private Boolean bot;
|
||||
@JsonProperty("created_at")
|
||||
private String createdAt;
|
||||
@JsonProperty("avatar")
|
||||
private String avatar;
|
||||
@JsonProperty("display_name")
|
||||
private String displayName;
|
||||
@JsonProperty("header_static")
|
||||
private String headerStatic;
|
||||
@JsonProperty("url")
|
||||
private String url;
|
||||
@JsonProperty("following_count")
|
||||
private Integer followingCount;
|
||||
@JsonProperty("statuses_count")
|
||||
private Integer statusesCount;
|
||||
@JsonProperty("followers_count")
|
||||
private Integer followersCount;
|
||||
@JsonProperty("header")
|
||||
private String header;
|
||||
@JsonProperty("id")
|
||||
private String id;
|
||||
@JsonProperty("locked")
|
||||
private Boolean locked;
|
||||
@JsonProperty("avatar_static")
|
||||
private String avatarStatic;
|
||||
@JsonProperty("fields")
|
||||
private List<Object> fields = null;
|
||||
@JsonProperty("acct")
|
||||
private String acct;
|
||||
@JsonProperty("username")
|
||||
private String username;
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
package ctbrec.ui.news;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import ctbrec.Config;
|
||||
import ctbrec.GlobalThreadPool;
|
||||
import ctbrec.Version;
|
||||
import ctbrec.io.HttpException;
|
||||
import ctbrec.io.json.ObjectMapperFactory;
|
||||
import ctbrec.ui.CamrecApplication;
|
||||
import ctbrec.ui.controls.Dialogs;
|
||||
import ctbrec.ui.tabs.TabSelectionListener;
|
||||
import javafx.application.Platform;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.control.ScrollPane;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.layout.VBox;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import okhttp3.Request;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
import static ctbrec.ErrorMessages.HTTP_RESPONSE_BODY_IS_NULL;
|
||||
import static ctbrec.io.HttpConstants.USER_AGENT;
|
||||
|
||||
@Slf4j
|
||||
public class NewsTab extends Tab implements TabSelectionListener {
|
||||
private static final String ACCESS_TOKEN = "a2804d73a89951a22e0f8483a6fcec8943afd88b7ba17c459c095aa9e6f94fd0";
|
||||
private static final String URL = "https://mastodon.cloud/api/v1/accounts/480960/statuses?limit=20&exclude_replies=true";
|
||||
private final Config config;
|
||||
private final VBox layout = new VBox();
|
||||
|
||||
private final ObjectMapper mapper = ObjectMapperFactory.getMapper();
|
||||
|
||||
public NewsTab(Config config) {
|
||||
this.config = config;
|
||||
setText("News");
|
||||
layout.setMaxWidth(800);
|
||||
layout.setAlignment(Pos.CENTER);
|
||||
setContent(new ScrollPane(layout));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selected() {
|
||||
GlobalThreadPool.submit(this::loadToots);
|
||||
}
|
||||
|
||||
private void loadToots() {
|
||||
try {
|
||||
var request = new Request.Builder()
|
||||
.url(URL)
|
||||
.header("Authorization", "Bearer " + ACCESS_TOKEN)
|
||||
.header(USER_AGENT, "ctbrec " + Version.getVersion())
|
||||
.build();
|
||||
try (var response = CamrecApplication.httpClient.execute(request)) {
|
||||
if (response.isSuccessful()) {
|
||||
var body = Objects.requireNonNull(response.body(), HTTP_RESPONSE_BODY_IS_NULL).string();
|
||||
log.debug(body);
|
||||
if (body.startsWith("[")) {
|
||||
onSuccess(body);
|
||||
} else if (body.startsWith("{")) {
|
||||
onError(body);
|
||||
} else {
|
||||
throw new IOException("Unexpected response: " + body);
|
||||
}
|
||||
} else {
|
||||
throw new HttpException(response.code(), response.message());
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.info("Error while loading news", e);
|
||||
Dialogs.showError(getTabPane().getScene(), "News", "Couldn't load news from mastodon", e);
|
||||
}
|
||||
}
|
||||
|
||||
private void onError(String body) throws IOException {
|
||||
var json = new JSONObject(body);
|
||||
if (json.has("error")) {
|
||||
throw new IOException("Request not successful: " + json.getString("error"));
|
||||
} else {
|
||||
throw new IOException("Unexpected response: " + body);
|
||||
}
|
||||
}
|
||||
|
||||
private void onSuccess(String body) throws IOException {
|
||||
Status[] statusArray = mapper.readValue(body, Status[].class);
|
||||
Platform.runLater(() -> {
|
||||
layout.getChildren().clear();
|
||||
for (Status status : statusArray) {
|
||||
if (status.getInReplyToId() == null && !Objects.equals("direct", status.getVisibility())) {
|
||||
var stp = new StatusPane(status, config.getDateTimeFormatter());
|
||||
layout.getChildren().add(stp);
|
||||
VBox.setMargin(stp, new Insets(10));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deselected() {
|
||||
// nothing to do
|
||||
}
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
package ctbrec.ui.news;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class Status {
|
||||
|
||||
@JsonProperty("pinned")
|
||||
private Boolean pinned;
|
||||
@JsonProperty("in_reply_to_id")
|
||||
private Object inReplyToId;
|
||||
@JsonProperty("favourites_count")
|
||||
private Integer favouritesCount;
|
||||
@JsonProperty("media_attachments")
|
||||
private List<Object> mediaAttachments = null;
|
||||
@JsonProperty("created_at")
|
||||
private String createdAt;
|
||||
@JsonProperty("replies_count")
|
||||
private Integer repliesCount;
|
||||
@JsonProperty("language")
|
||||
private String language;
|
||||
@JsonProperty("in_reply_to_account_id")
|
||||
private Object inReplyToAccountId;
|
||||
@JsonProperty("content")
|
||||
private String content;
|
||||
@JsonProperty("reblog")
|
||||
private Object reblog;
|
||||
@JsonProperty("spoiler_text")
|
||||
private String spoilerText;
|
||||
@JsonProperty("id")
|
||||
private String id;
|
||||
@JsonProperty("reblogged")
|
||||
private Boolean reblogged;
|
||||
@JsonProperty("muted")
|
||||
private Boolean muted;
|
||||
@JsonProperty("emojis")
|
||||
private List<Object> emojis = null;
|
||||
@JsonProperty("reblogs_count")
|
||||
private Integer reblogsCount;
|
||||
@JsonProperty("visibility")
|
||||
private String visibility;
|
||||
@JsonProperty("sensitive")
|
||||
private Boolean sensitive;
|
||||
@JsonProperty("uri")
|
||||
private String uri;
|
||||
@JsonProperty("url")
|
||||
private String url;
|
||||
@JsonProperty("tags")
|
||||
private List<Object> tags = null;
|
||||
@JsonProperty("application")
|
||||
private Object application;
|
||||
@JsonProperty("favourited")
|
||||
private Boolean favourited;
|
||||
@JsonProperty("mentions")
|
||||
private List<Object> mentions = null;
|
||||
@JsonProperty("account")
|
||||
private Account account;
|
||||
@JsonProperty("card")
|
||||
private Object card;
|
||||
|
||||
public ZonedDateTime getCreationTime() {
|
||||
String timestamp = getCreatedAt();
|
||||
var instant = Instant.parse(timestamp);
|
||||
var time = ZonedDateTime.ofInstant(instant, ZoneId.systemDefault());
|
||||
return time;
|
||||
}
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
package ctbrec.ui.news;
|
||||
|
||||
import ctbrec.io.HtmlParser;
|
||||
import ctbrec.ui.DesktopIntegration;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Orientation;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.shape.Rectangle;
|
||||
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Set;
|
||||
|
||||
public class StatusPane extends StackPane {
|
||||
|
||||
TextArea content;
|
||||
Button reply;
|
||||
|
||||
public StatusPane(Status status, DateTimeFormatter formatter) {
|
||||
String text = HtmlParser.getText("<div>" + status.getContent() + "</div>", "div");
|
||||
|
||||
content = new TextArea(text);
|
||||
content.setMaxHeight(130);
|
||||
content.setEditable(false);
|
||||
content.setWrapText(true);
|
||||
getChildren().add(content);
|
||||
|
||||
ZonedDateTime createdAt = status.getCreationTime();
|
||||
String creationTime = formatter.format(createdAt);
|
||||
var time = new Label(creationTime);
|
||||
time.setStyle("-fx-background-color: -fx-base");
|
||||
time.setOpacity(.7);
|
||||
time.setPadding(new Insets(3));
|
||||
time.setOnMouseEntered(evt -> time.setOpacity(1));
|
||||
time.setOnMouseExited(evt -> time.setOpacity(.7));
|
||||
getChildren().add(time);
|
||||
StackPane.setMargin(time, new Insets(5, 5, 5, 10));
|
||||
StackPane.setAlignment(time, Pos.BOTTOM_LEFT);
|
||||
var clip = new Rectangle(time.getWidth(), time.getHeight());
|
||||
clip.heightProperty().bind(time.heightProperty());
|
||||
clip.widthProperty().bind(time.widthProperty());
|
||||
clip.setArcHeight(5);
|
||||
clip.arcWidthProperty().bind(clip.arcHeightProperty());
|
||||
time.setClip(clip);
|
||||
|
||||
reply = new Button("Reply");
|
||||
reply.setOnAction(evt -> DesktopIntegration.open(status.getUrl()));
|
||||
getChildren().add(reply);
|
||||
StackPane.setMargin(reply, new Insets(5, 5, 5, 5));
|
||||
StackPane.setAlignment(reply, Pos.BOTTOM_RIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void layoutChildren() {
|
||||
ObservableList<Node> childrenUnmodifiable = content.getChildrenUnmodifiable();
|
||||
for (Node node : childrenUnmodifiable) {
|
||||
if (node instanceof ScrollPane scrollPane) {
|
||||
Set<Node> nodes = scrollPane.lookupAll(".scroll-bar");
|
||||
for (final Node child : nodes) {
|
||||
if (child instanceof ScrollBar sb && sb.getOrientation() == Orientation.VERTICAL) {
|
||||
if (sb.isVisible()) {
|
||||
StackPane.setMargin(reply, new Insets(5, 22, 5, 5));
|
||||
} else {
|
||||
StackPane.setMargin(reply, new Insets(5, 5, 5, 5));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
super.layoutChildren();
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package ctbrec.ui.tabs.logging;
|
||||
|
||||
import ch.qos.logback.classic.spi.LoggingEvent;
|
||||
import ch.qos.logback.core.ConsoleAppender;
|
||||
import ctbrec.event.EventBusHolder;
|
||||
|
||||
public class CtbrecAppender extends ConsoleAppender<LoggingEvent> {
|
||||
|
||||
@Override
|
||||
protected void append(LoggingEvent event) {
|
||||
EventBusHolder.BUS.post(event);
|
||||
}
|
||||
}
|
|
@ -1,231 +0,0 @@
|
|||
package ctbrec.ui.tabs.logging;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
|
||||
import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
|
||||
import ch.qos.logback.classic.spi.IThrowableProxy;
|
||||
import ch.qos.logback.classic.spi.LoggingEvent;
|
||||
import ch.qos.logback.classic.spi.StackTraceElementProxy;
|
||||
import ctbrec.Config;
|
||||
import ctbrec.event.EventBusHolder;
|
||||
import ctbrec.ui.controls.CustomMouseBehaviorContextMenu;
|
||||
import ctbrec.ui.controls.SearchBox;
|
||||
import ctbrec.ui.tabs.TabSelectionListener;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.control.ContextMenu;
|
||||
import javafx.scene.control.MenuItem;
|
||||
import javafx.scene.control.SelectionMode;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.input.Clipboard;
|
||||
import javafx.scene.input.ClipboardContent;
|
||||
import javafx.scene.input.ContextMenuEvent;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.BorderPane;
|
||||
|
||||
public class LoggingTab extends Tab implements TabSelectionListener {
|
||||
|
||||
private static final int HISTORY_LENGTH = 10_000;
|
||||
private SearchBox filter = new SearchBox();
|
||||
private TableView<LoggingEvent> table = new TableView<>();
|
||||
private ObservableList<LoggingEvent> history = FXCollections.observableList(Collections.synchronizedList(new LinkedList<>()));
|
||||
private ObservableList<LoggingEvent> filteredEvents = FXCollections.observableArrayList();
|
||||
private List<LoggingEvent> eventBuffer = new LinkedList<>();
|
||||
private DateTimeFormatter timeFormatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME;
|
||||
private volatile boolean tabClosed = false;
|
||||
private volatile boolean tabSelected = false;
|
||||
private ContextMenu popup;
|
||||
private Object eventBustSubscriber = new Object() {
|
||||
@Subscribe
|
||||
public void publishLoggingEevent(LoggingEvent event) {
|
||||
if (!tabClosed) {
|
||||
if (tabSelected) {
|
||||
Platform.runLater(() -> {
|
||||
history.add(event);
|
||||
if (history.size() > HISTORY_LENGTH - 1) {
|
||||
history.remove(0);
|
||||
}
|
||||
filter();
|
||||
});
|
||||
} else {
|
||||
eventBuffer.add(event);
|
||||
if (eventBuffer.size() > HISTORY_LENGTH - 1) {
|
||||
eventBuffer.remove(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private void filter() {
|
||||
filteredEvents.clear();
|
||||
filteredEvents.addAll(history.stream().filter(evt -> {
|
||||
String q = filter.getText().toLowerCase();
|
||||
return evt.getLevel().toString().toLowerCase().contains(q)
|
||||
|| createLogMessage(evt).toLowerCase().contains(q);
|
||||
}).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
public LoggingTab() {
|
||||
setText("Logging");
|
||||
subscribeToEventBus();
|
||||
|
||||
Config config = Config.getInstance();
|
||||
table = new TableView<>(filteredEvents);
|
||||
if (!config.getSettings().showGridLinesInTables) {
|
||||
table.setStyle("-fx-table-cell-border-color: transparent;");
|
||||
}
|
||||
|
||||
var idx = 0;
|
||||
TableColumn<LoggingEvent, String> level = createTableColumn("Level", 65, idx++);
|
||||
level.setCellValueFactory(cdf -> new SimpleStringProperty(cdf.getValue().getLevel().toString()));
|
||||
table.getColumns().add(level);
|
||||
|
||||
TableColumn<LoggingEvent, String> time = createTableColumn("Timestamp", 200, idx++);
|
||||
time.setCellValueFactory(cdf -> {
|
||||
var instant = Instant.ofEpochMilli(cdf.getValue().getTimeStamp());
|
||||
return new SimpleStringProperty(instant.atZone(ZoneId.systemDefault()).format(timeFormatter));
|
||||
});
|
||||
table.getColumns().add(time);
|
||||
|
||||
TableColumn<LoggingEvent, String> location = createTableColumn("Location", 250, idx++);
|
||||
location.setCellValueFactory(cdf -> {
|
||||
if(cdf.getValue().getCallerData().length > 0) {
|
||||
StackTraceElement loc = cdf.getValue().getCallerData()[0];
|
||||
String l = loc.getFileName() + ":" + loc.getLineNumber();
|
||||
return new SimpleStringProperty(l);
|
||||
} else {
|
||||
return new SimpleStringProperty("");
|
||||
}
|
||||
});
|
||||
table.getColumns().add(location);
|
||||
|
||||
TableColumn<LoggingEvent, String> msg = createTableColumn("Message", 2000, idx++);
|
||||
msg.setCellValueFactory(cdf -> new SimpleStringProperty(createLogMessage(cdf.getValue())));
|
||||
table.getColumns().add(msg);
|
||||
|
||||
var layout = new BorderPane();
|
||||
BorderPane.setMargin(table, new Insets(10));
|
||||
BorderPane.setMargin(filter, new Insets(10, 10, 0, 10));
|
||||
layout.setCenter(table);
|
||||
layout.setTop(filter);
|
||||
|
||||
setContent(layout);
|
||||
setOnClosed(evt -> {
|
||||
EventBusHolder.BUS.unregister(eventBustSubscriber);
|
||||
tabClosed = true;
|
||||
});
|
||||
|
||||
filter.setPromptText("Search");
|
||||
filter.textProperty().addListener( (observableValue, oldValue, newValue) -> filter());
|
||||
|
||||
table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
|
||||
table.addEventHandler(ContextMenuEvent.CONTEXT_MENU_REQUESTED, event -> {
|
||||
popup = createContextMenu();
|
||||
if (popup != null) {
|
||||
popup.show(table, event.getScreenX(), event.getScreenY());
|
||||
}
|
||||
event.consume();
|
||||
});
|
||||
table.addEventHandler(MouseEvent.MOUSE_PRESSED, event -> {
|
||||
if (popup != null) {
|
||||
popup.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private ContextMenu createContextMenu() {
|
||||
final ObservableList<LoggingEvent> selectedEvents = table.getSelectionModel().getSelectedItems();
|
||||
if (selectedEvents.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
var copy = new MenuItem("Copy");
|
||||
copy.setOnAction(e -> Platform.runLater(() -> {
|
||||
String formattedMessages = getFormattedMessages(selectedEvents);
|
||||
final var content = new ClipboardContent();
|
||||
content.putString(formattedMessages);
|
||||
Clipboard.getSystemClipboard().setContent(content);
|
||||
}));
|
||||
|
||||
ContextMenu menu = new CustomMouseBehaviorContextMenu(copy);
|
||||
return menu;
|
||||
}
|
||||
|
||||
private String getFormattedMessages(ObservableList<LoggingEvent> selectedEvents) {
|
||||
var sb = new StringBuilder();
|
||||
|
||||
var rootLogger = (ch.qos.logback.classic.Logger)LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
|
||||
var loggerContext = rootLogger.getLoggerContext();
|
||||
loggerContext.reset();
|
||||
|
||||
var encoder = new PatternLayoutEncoder();
|
||||
encoder.setContext(loggerContext);
|
||||
encoder.setPattern("%date %level [%thread] %logger{10} [%file:%line] %msg%n");
|
||||
encoder.start();
|
||||
|
||||
for (LoggingEvent evt : selectedEvents) {
|
||||
byte[] encode = encoder.encode(evt);
|
||||
sb.append(new String(encode));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private String createLogMessage(LoggingEvent evt) {
|
||||
var sb = new StringBuilder(evt.getFormattedMessage());
|
||||
IThrowableProxy throwableProxy = evt.getThrowableProxy();
|
||||
while (throwableProxy != null) {
|
||||
sb.append('\n').append(throwableProxy.getClassName()).append(':').append(' ').append(throwableProxy.getMessage());
|
||||
for (StackTraceElementProxy step : throwableProxy.getStackTraceElementProxyArray()) {
|
||||
sb.append('\n').append('\t').append(step.getSTEAsString());
|
||||
}
|
||||
throwableProxy = throwableProxy.getCause();
|
||||
if (throwableProxy != null) {
|
||||
sb.append("\nCaused by: ");
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private <T> TableColumn<LoggingEvent, T> createTableColumn(String text, int width, int idx) {
|
||||
TableColumn<LoggingEvent, T> tc = new TableColumn<>(text);
|
||||
tc.setPrefWidth(width);
|
||||
tc.setUserData(idx);
|
||||
return tc;
|
||||
}
|
||||
|
||||
private void subscribeToEventBus() {
|
||||
EventBusHolder.BUS.register(eventBustSubscriber);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void selected() {
|
||||
history.addAll(eventBuffer);
|
||||
tabSelected = true;
|
||||
while (history.size() > HISTORY_LENGTH - 1) {
|
||||
history.remove(0);
|
||||
}
|
||||
filter();
|
||||
eventBuffer.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deselected() {
|
||||
tabSelected = false;
|
||||
}
|
||||
}
|
|
@ -9,12 +9,6 @@
|
|||
</encoder>
|
||||
</appender>
|
||||
|
||||
<appender name="GUI" class="ctbrec.ui.tabs.logging.CtbrecAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<appender name="FILE"
|
||||
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>ctbrec.log</file>
|
||||
|
@ -38,7 +32,6 @@
|
|||
<root level="DEBUG">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="FILE"/>
|
||||
<appender-ref ref="GUI"/>
|
||||
</root>
|
||||
|
||||
|
||||
|
@ -46,13 +39,13 @@
|
|||
<logger name="ctbrec.io.CookieJarImpl" level="INFO"/>
|
||||
<logger name="ctbrec.recorder.FFmpeg" level="DEBUG"/>
|
||||
<logger name="ctbrec.recorder.OnlineMonitor" level="INFO"/>
|
||||
<logger name="ctbrec.recorder.RecordingFileMonitor" level="TRACE"/>
|
||||
<logger name="ctbrec.recorder.RecordingFileMonitor" level="INFO"/>
|
||||
<logger name="ctbrec.recorder.download.dash.DashDownload" level="DEBUG"/>
|
||||
<logger name="ctbrec.recorder.server.HlsServlet" level="INFO"/>
|
||||
<logger name="ctbrec.recorder.server.RecorderServlet" level="INFO"/>
|
||||
<logger name="ctbrec.recorder.ThreadPoolScaler" level="DEBUG"/>
|
||||
<logger name="ctbrec.ui.ExternalBrowser" level="DEBUG"/>
|
||||
<logger name="ctbrec.ui.ThumbOverviewTab" level="DEBUG"/>
|
||||
<logger name="ctbrec.ui.ExternalBrowser" level="INFO"/>
|
||||
<logger name="ctbrec.ui.ThumbOverviewTab" level="INFO"/>
|
||||
<logger name="org.eclipse.jetty" level="INFO"/>
|
||||
|
||||
</configuration>
|
||||
|
|
Loading…
Reference in New Issue