Merge pull request 'allow cwtch to log to file' (#367) from dan/ui:logFlag into master
the build was successful
Details
the build was successful
Details
Reviewed-on: #367
This commit is contained in:
commit
01428b1371
11
main.go
11
main.go
|
@ -54,16 +54,21 @@ func main() {
|
||||||
event.NewGetValMessageFromPeer,
|
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!")
|
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")
|
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")
|
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")
|
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")
|
flagConsole := flag.Bool("console", false, "on windows, force logging to console instead of file")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if runtime.GOOS == "windows" && !*flagConsole {
|
if *flagLogFile != "" && !*flagConsole {
|
||||||
filelogger, err := log.NewFile(log.LevelInfo, "cwtch_log.txt")
|
filelogger, err := log.NewFile(log.LevelInfo, *flagLogFile)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
log.SetStd(filelogger)
|
log.SetStd(filelogger)
|
||||||
}
|
}
|
||||||
|
@ -305,7 +310,7 @@ func loadNetworkingAndFiles(gcd *ui.GrandCentralDispatcher, service bool, client
|
||||||
}
|
}
|
||||||
|
|
||||||
loadACN()
|
loadACN()
|
||||||
pid,err := the.ACN.GetPID()
|
pid, err := the.ACN.GetPID()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
gcd.GlobalSettings.PreviousPid = int64(pid)
|
gcd.GlobalSettings.PreviousPid = int64(pid)
|
||||||
ui.WriteGlobalSettings(gcd.GlobalSettings)
|
ui.WriteGlobalSettings(gcd.GlobalSettings)
|
||||||
|
|
Reference in New Issue