mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-13 00:36:28 +00:00
Merge pull request #2206 from calmh/logfile
Allow -logfile on all platforms (fixes #2004)
This commit is contained in:
commit
72fa5a69f1
@ -218,11 +218,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")
|
||||
@ -262,14 +263,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 {
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user