Skip to content

Commit

Permalink
Logging fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
crschnick committed Oct 17, 2024
1 parent 0c85ba0 commit c084a55
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions app/src/main/java/io/xpipe/app/prefs/LoggingCategory.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import io.xpipe.app.issue.ErrorEvent;
import io.xpipe.app.util.DesktopHelper;
import io.xpipe.app.util.LicenseProvider;
import io.xpipe.app.util.LicensedFeature;
import io.xpipe.app.util.OptionsBuilder;

import java.io.IOException;
Expand All @@ -22,9 +23,8 @@ protected String getId() {
@Override
protected Comp<?> create() {
var prefs = AppPrefs.get();
var supported = LicenseProvider.get()
.getFeature("logging")
.isSupported();
var feature = LicenseProvider.get().getFeature("logging");
var supported = feature.isSupported() || feature.isPreviewSupported();
var title = AppI18n.observable("sessionLogging")
.map(s -> s + (supported
? ""
Expand Down
11 changes: 7 additions & 4 deletions app/src/main/java/io/xpipe/app/util/TerminalLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,13 @@ private static ExternalTerminalType.LaunchConfiguration createConfig(
var launcherScript = d.terminalLauncherScript(request, adjustedTitle);
var preparationScript = ScriptHelper.createLocalExecScript(launcherScript);

var supported = LicenseProvider.get()
.getFeature("logging")
var feature = LicenseProvider.get().getFeature("logging");
var supported = feature
.isSupported();
if (!AppPrefs.get().enableTerminalLogging().get() || !supported) {
if (!supported) {
throw new LicenseRequiredException(feature);
}
if (!AppPrefs.get().enableTerminalLogging().get()) {
var config = new ExternalTerminalType.LaunchConfiguration(
entry != null ? color : null, adjustedTitle, cleanTitle, preparationScript, d);
return config;
Expand Down Expand Up @@ -136,7 +139,7 @@ private static ExternalTerminalType.LaunchConfiguration createConfig(
var suffix = sc.getOsType() == OsType.MACOS ? "This command is available in the util-linux package which can be installed via homebrew." : "This command is available in the util-linux package.";
throw ErrorEvent.expected(new IllegalStateException("Logging requires the script command to be installed. " + suffix));
}

var content = sc.getOsType() == OsType.MACOS || sc.getOsType() == OsType.BSD ?
"""
echo "Transcript started, output file is sessions/%s"
Expand Down

0 comments on commit c084a55

Please sign in to comment.