summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakob Borg <jakob@nym.se>2015-08-27 18:19:06 +0200
committerJakob Borg <jakob@nym.se>2015-08-30 13:37:18 +0200
commit2eece95ed2516c46639170d87dc0f2b9934d93ac (patch)
treed7cfac1cc27fb6badb9b26474208063147273dc6
parent008b07a52f2d8755ee036b73d7d66ecec443f6f3 (diff)
Allow -logfile on all platforms (fixes #2004)v0.11.23
-rw-r--r--cmd/syncthing/main.go14
-rw-r--r--cmd/syncthing/monitor.go2
2 files changed, 6 insertions, 10 deletions
diff --git a/cmd/syncthing/main.go b/cmd/syncthing/main.go
index 9c2c1ce600..91ea23b4ee 100644
--- a/cmd/syncthing/main.go
+++ b/cmd/syncthing/main.go
@@ -214,11 +214,12 @@ func main() {
if runtime.GOOS == "windows" {
// On Windows, we use a log file by default. Setting the -logfile flag
// to "-" disables this behavior.
-
flag.StringVar(&logFile, "logfile", "", "Log file name (use \"-\" for stdout)")
// We also add an option to hide the console window
flag.BoolVar(&noConsole, "no-console", false, "Hide console window")
+ } else {
+ flag.StringVar(&logFile, "logfile", "-", "Log file name (use \"-\" for stdout)")
}
flag.StringVar(&generateDir, "generate", "", "Generate key and config in specified dir, then exit")
@@ -257,14 +258,9 @@ func main() {
guiAssets = locations[locGUIAssets]
}
- if runtime.GOOS == "windows" {
- if logFile == "" {
- // Use the default log file location
- logFile = locations[locLogFile]
- } else if logFile == "-" {
- // Don't use a logFile
- logFile = ""
- }
+ if logFile == "" {
+ // Use the default log file location
+ logFile = locations[locLogFile]
}
if showVersion {
diff --git a/cmd/syncthing/monitor.go b/cmd/syncthing/monitor.go
index a5ff1c30ce..955e2bfea9 100644
--- a/cmd/syncthing/monitor.go
+++ b/cmd/syncthing/monitor.go
@@ -40,7 +40,7 @@ func monitorMain() {
var err error
var dst io.Writer = os.Stdout
- if logFile != "" {
+ if logFile != "-" {
var fileDst io.Writer
fileDst, err = os.Create(logFile)