feat: enhance Linux support with ydotool integration and improve logging

This commit is contained in:
Your Name
2026-06-09 00:25:05 -07:00
parent bc3d8cbce3
commit 05c8fbc474
7 changed files with 421 additions and 118 deletions
+9 -2
View File
@@ -76,6 +76,11 @@ func Error(format string, args ...interface{}) {
log("ERROR", format, args...)
}
// Debug logs a debug message with timestamp.
func Debug(format string, args ...interface{}) {
log("DEBUG", format, args...)
}
// log writes a formatted log message to the log file and console.
func log(level, format string, args ...interface{}) {
logMutex.Lock()
@@ -103,7 +108,9 @@ func log(level, format string, args ...interface{}) {
if logFile != nil {
logFile.WriteString(logLine)
logFile.Sync()
// Do NOT call Sync() on every write — that's a massive performance
// bottleneck (forces fsync to disk for every single log line).
// The kernel will flush buffered writes in its own time.
}
}
@@ -141,4 +148,4 @@ func getLogPath() (string, error) {
}
return filepath.Join(homeDir, ".wis-free-v3", "logs", time.Now().Format("2006-01-02")+".log"), nil
}
}