Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,6 @@ class SyncthingService : Service(), SyncthingStatusReceiver, DeviceStateListener
prefs = Preferences(this)
prefs.registerListener(this)

setLogLevel()

notifications = Notifications(this)

deviceStateTracker = DeviceStateTracker(this)
Expand Down Expand Up @@ -609,10 +607,6 @@ class SyncthingService : Service(), SyncthingStatusReceiver, DeviceStateListener
when (key) {
in BLOCKED_REASONS_PREFS, in DeviceState.PREFS -> recomputeBlockedReasons = true
in STATE_CHANGE_PREFS -> {}
Preferences.PREF_DEBUG_MODE -> {
setLogLevel()
return
}
else -> return
}

Expand All @@ -629,13 +623,6 @@ class SyncthingService : Service(), SyncthingStatusReceiver, DeviceStateListener
}
}

private fun setLogLevel() {
val level = if (prefs.isDebugMode) { "DEBUG" } else { "INFO" }
Log.d(TAG, "Setting Syncthing log level to $level")

Stbridge.setLogLevel(level)
}

private fun stateChanged(
recomputeBlockedReasons: Boolean = false,
forceShowNotification: Boolean = false,
Expand Down
18 changes: 0 additions & 18 deletions stbridge/stbridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"io"
"iter"
"log"
"log/slog"
"net"
_ "net/http"
"os"
Expand Down Expand Up @@ -167,23 +166,6 @@ func applyProxySettings(proxy string, no_proxy string) {
resetProxyConfig()
}

//go:linkname slogutilSetDefaultLevel github.com/syncthing/syncthing/internal/slogutil.SetDefaultLevel
func slogutilSetDefaultLevel(level slog.Level)

// This is thread-safe because syncthing's internal levelTracker.SetDefault() is
// thread-safe.
func SetLogLevel(level string) error {
var slogLevel slog.Level

if err := slogLevel.UnmarshalText([]byte(level)); err != nil {
return fmt.Errorf("invalid log level: %q", level)
}

slogutilSetDefaultLevel(slogLevel)

return nil
}

func InitDirs(filesDir string, cacheDir string, externalDir string) error {
stLock.Lock()
defer stLock.Unlock()
Expand Down