Merge pull request #984 from gucio321/escape-menu2

hotfix: logger in d2app
This commit is contained in:
Tim Sarbin 2020-12-17 11:37:13 -05:00 committed by GitHub
commit 6497493d57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 10 deletions

View File

@ -233,11 +233,12 @@ func (a *App) parseArguments() {
loggingShort = 'l'
loggingDesc = "Enables verbose logging. Log levels will include those below it. " +
"0 disables log messages, " +
"1 shows errors, " +
"2 shows warnings, " +
"3 shows info, " +
"4 shows debug" +
"5 uses value from config file (default)"
"1 shows fatal errors, " +
"2 shows errors, " +
"3 shows warnings, " +
"4 shows info, " +
"5 shows debug" +
"6 uses value from config file (default)"
)
a.Options.profiler = kingpin.Flag(profilerArg, profilerDesc).String()
@ -315,7 +316,7 @@ func (a *App) Run() error {
a.gitCommit = "build"
}
fmt.Printf(fmtVersion, a.gitBranch, a.gitCommit)
a.Errorf(fmtVersion, a.gitBranch, a.gitCommit)
os.Exit(0)
}
@ -739,7 +740,7 @@ func (a *App) doCaptureFrame(target d2interface.Surface) error {
return err
}
a.Info(fmt.Sprintf("saved frame to %s", a.capturePath))
a.Infof("saved frame to %s", a.capturePath)
return nil
}
@ -799,7 +800,7 @@ func (a *App) convertFramesToGif() error {
return err
}
a.Info(fmt.Sprintf("saved animation to %s", a.capturePath))
a.Infof("saved animation to %s", a.capturePath)
return nil
}
@ -937,7 +938,7 @@ func (a *App) ToCreateGame(filePath string, connType d2clientconnectiontype.Clie
if err = gameClient.Open(host, filePath); err != nil {
errorMessage := fmt.Sprintf("can not connect to the host: %s", host)
fmt.Println(errorMessage)
a.Error(errorMessage)
a.ToMainMenu(errorMessage)
} else {
game, err := d2gamescreen.CreateGame(
@ -956,7 +957,7 @@ func (a *App) ToCharacterSelect(connType d2clientconnectiontype.ClientConnection
characterSelect, err := d2gamescreen.CreateCharacterSelect(a, a.asset, a.renderer, a.inputManager,
a.audio, a.ui, connType, a.config.LogLevel, connHost)
if err != nil {
fmt.Printf("unable to create character select screen: %s", err)
a.Errorf("unable to create character select screen: %s", err)
}
a.screen.SetNextScreen(characterSelect)