allow cwtch to log to file
the build was successful Details

This commit is contained in:
Dan Ballard 2020-11-13 12:13:53 -08:00
parent c11e541f4e
commit 568b979698
1 changed files with 8 additions and 3 deletions

View File

@ -54,16 +54,21 @@ func main() {
event.NewGetValMessageFromPeer,
}
logfileDefault := ""
if runtime.GOOS == "windows" {
logfileDefault = "cwtch_log.txt"
}
flagDebug := flag.Bool("debug", false, "turn on extra logging. WARNING: THIS MAY EXPOSE PRIVATE INFORMATION IN CONSOLE OUTPUT!")
flagLogFile := flag.String("logfile", logfileDefault, "specify a file name to log to. --console overrides")
flagLocal := flag.Bool("local", false, "load user interface from the local folder \"qml\" instead of the built-in UI")
flagService := flag.Bool("service", false, "run this process as an android service")
flagClientUI := flag.Bool("clientui", false, "start the UI as a client of a service app instead of a full app")
flagConsole := flag.Bool("console", false, "on windows, force logging to console instead of file")
flag.Parse()
if runtime.GOOS == "windows" && !*flagConsole {
filelogger, err := log.NewFile(log.LevelInfo, "cwtch_log.txt")
if *flagLogFile != "" && !*flagConsole {
filelogger, err := log.NewFile(log.LevelInfo, *flagLogFile)
if err == nil {
log.SetStd(filelogger)
}