From e904f1139ae5a65e5197863640e86fe4bb35d00a Mon Sep 17 00:00:00 2001 From: Mark D Horn Date: Fri, 15 Feb 2019 14:16:51 -0800 Subject: [PATCH] Ask the user to submit bugs Provide directions for submitting bugs including what data to include and how to enable debug logging. Signed-off-by: Mark D Horn --- clr-installer/main.go | 2 ++ log/log.go | 24 +++++++++++++++++++++++- log/log_test.go | 10 ++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/clr-installer/main.go b/clr-installer/main.go index 984d549..ce53c62 100644 --- a/clr-installer/main.go +++ b/clr-installer/main.go @@ -255,6 +255,7 @@ func main() { fmt.Printf(" %s\n", err) os.Exit(1) } else { + log.RequestCrashInfo() fatal(err) } } @@ -287,5 +288,6 @@ func main() { } fatal(err) } + log.RequestCrashInfo() } } diff --git a/log/log.go b/log/log.go index 4129aae..6cc1712 100644 --- a/log/log.go +++ b/log/log.go @@ -86,7 +86,29 @@ func SetOutputFilename(logFile string) (*os.File, error) { return filehandle, nil } -// GetPreConfFile ... get the filename log output to filename instead of stdout/stderr +// RequestCrashInfo prints information for the user on how to properly report the +// crash of the installer and how to gather more information +func RequestCrashInfo() { + fmt.Println("Please report this crash using GitHub Issues:") + fmt.Println("\thttps://github.com/clearlinux/clr-installer/issues") + + fmt.Println("") + + fmt.Println("Include the following as attachments to enable diagnosis:") + fmt.Printf("\t%s\n", preConfName) + fmt.Printf("\t%s\n", logFileName) + + fmt.Println("") + + fmt.Println("If the problem persists, enabling additional logging will be helpful in") + fmt.Println("diagnosing the issue. At the OS Boot screen, hit 'e' to edit the kernel") + fmt.Println("command line. Add the following to the end of the line:") + fmt.Println("\tclri.loglevel=4") + + fmt.Println("") +} + +// GetPreConfFile ... returns the filename of where to store the pre-configuration file func GetPreConfFile() string { return preConfName } diff --git a/log/log_test.go b/log/log_test.go index 0a649f9..8cd6f0a 100644 --- a/log/log_test.go +++ b/log/log_test.go @@ -280,3 +280,13 @@ func TestFailedToSetOutput(t *testing.T) { t.Fatal("Should have failed to open log file") } } + +func TestGetPreConfFile(t *testing.T) { + if GetPreConfFile() != preConfName { + t.Fatal("log.GetPreConfFile() should always match log.preConfName") + } +} + +func TestRequestCrashInfo(t *testing.T) { + RequestCrashInfo() +}