INNER CODE UNIT · Go
func
OpenDiablo2/HellSpawner · hsapp/app.go:122
func (a *App) Run() (err error) {
defer a.Quit() // force-close and save everything (in case of crash)
// setting up the logging here, as opposed to inside of app.setup(),
// because of the deferred call to logfile.Close()
if a.config.LoggingToFile || *a.Flags.logFile != "" {
path := a.config.LogFilePath
if *a.Flags.logFile != "" {
path = *a.Flags.logFile
}
a.logFile, err = os.OpenFile(filepath.Clean(path), os.O_CREATE|os.O_APPEND|os.O_WRONLY, logFilePerms)
if err != nil {
logErr("Error opening log file at %s: %v", a.config.LogFilePath, err)
}
defer func() {
if logErr := a.logFile.Close(); logErr != nil {