Skip to content

Commit

Permalink
chore: small refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
rvullriede committed Dec 20, 2024
1 parent e9b9aba commit 928f612
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions src/main/java/net/osslabz/loggazer/LogGazerApp.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.osslabz.loggazer;

import ch.qos.logback.classic.Level;
import java.awt.Taskbar;
import java.awt.Toolkit;
import java.io.File;
Expand All @@ -11,8 +12,6 @@
import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import ch.qos.logback.classic.Level;
import javafx.application.Application;
import javafx.concurrent.Task;
import javafx.scene.Scene;
Expand Down Expand Up @@ -55,7 +54,7 @@ public class LogGazerApp extends Application {

public static final String SEARCH_QUERY_PLACEHOLDER = "Search...";

private static boolean loggingEnabled = false;
private static boolean loggingDisabled = true;

private final ExecutorService executor = Executors.newSingleThreadExecutor();

Expand All @@ -80,7 +79,7 @@ public class LogGazerApp extends Application {

public static void main(String[] args) {

if (!loggingEnabled) {
if (loggingDisabled) {
disableLogging();
}

Expand All @@ -90,7 +89,7 @@ public static void main(String[] args) {
String paramLowerCase = StringUtils.stripStart(singleParam.trim().toLowerCase(), "-");
if (paramLowerCase.equals("version") || paramLowerCase.equals("v")) {
System.out.printf(
"""
"""
log-gazer %s%n
Copyright (C) 2024 Raphael Vullriede ([email protected])%n
License: Apache License Version 2.0, January 2004 <https://www.apache.org/licenses/LICENSE-2.0.txt>.%n
Expand Down Expand Up @@ -200,15 +199,15 @@ private ToolBar createToolBar() {
resetSearch();

toolBar.getItems().addAll(
this.buttonFormatJson,
new Separator(),
this.buttonMarkLogLevel,
new Separator(),
this.searchField,
this.searchButton,
this.prevMatchButton,
this.nextMatchButton,
this.matchCountLabel
this.buttonFormatJson,
new Separator(),
this.buttonMarkLogLevel,
new Separator(),
this.searchField,
this.searchButton,
this.prevMatchButton,
this.nextMatchButton,
this.matchCountLabel

);

Expand Down Expand Up @@ -262,7 +261,7 @@ private void navigateToCurrentMatch() {
int numMatches = tabContent.getSearchData().numMatches();

searchField.setText(StringUtils.isNotBlank(tabContent.getSearchData().getQuery()) ? tabContent.getSearchData().getQuery() :
SEARCH_QUERY_PLACEHOLDER);
SEARCH_QUERY_PLACEHOLDER);
matchCountLabel.setText(String.format("%d of %d matches", currentMatchIndex + 1, numMatches));

if (currentMatchIndex >= 0 && currentMatchIndex < numMatches) {
Expand Down Expand Up @@ -495,7 +494,7 @@ private void openFile() {
new FileChooser.ExtensionFilter("Compressed Files", "*.gz", "*.zip", "*.tar.gz")
*/
new FileChooser.ExtensionFilter("Files", "*.*")
new FileChooser.ExtensionFilter("Files", "*.*")

);
File file = fileChooser.showOpenDialog(null);
Expand All @@ -506,13 +505,14 @@ private void openFile() {


public static void enableLogging() {
loggingEnabled = true;

loggingDisabled = false;
}


private static void disableLogging() {
ch.qos.logback.classic.Logger rootLogger =
(ch.qos.logback.classic.Logger)LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);

ch.qos.logback.classic.Logger rootLogger = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME);
rootLogger.setLevel(Level.OFF);
}
}

0 comments on commit 928f612

Please sign in to comment.