Merge pull request 'allow cwtch to log to file' (#367) from dan/ui:logFlag into master
the build was successful Details

Reviewed-on: #367
This commit is contained in:
Sarah Jamie Lewis 2020-11-13 12:21:45 -08:00
commit 01428b1371
1 changed files with 8 additions and 3 deletions

11
main.go
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)
}
@ -305,7 +310,7 @@ func loadNetworkingAndFiles(gcd *ui.GrandCentralDispatcher, service bool, client
}
loadACN()
pid,err := the.ACN.GetPID()
pid, err := the.ACN.GetPID()
if err == nil {
gcd.GlobalSettings.PreviousPid = int64(pid)
ui.WriteGlobalSettings(gcd.GlobalSettings)