Skip to content

Commit

Permalink
Add developer-only toggle to print all errors
Browse files Browse the repository at this point in the history
When developing, we often want to see errors that we don't want in the
final output to a regular user.
Even though all errors are always logged to dump.log in the generated
archive, it is more convenient to see them straigh away in stderr,
without needing to go open the dump archive.
  • Loading branch information
rhcarvalho committed Sep 16, 2016
1 parent 051ac43 commit 146b6e4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ var (
printVersion = flag.Bool("version", false, "print version and exit")
)

// showAllErrors enables printing of ignorable errors, suitable for debugging.
// This is intentionally not exposed as a flag, and shall stay intentionally
// undocumented, used for development only.
var _, showAllErrors = os.LookupEnv("FH_SYSTEM_DUMP_TOOL_DEBUG")

// GetProjects returns a list of project names visible by the current logged in
// user.
func GetProjects(runner Runner) ([]string, error) {
Expand Down Expand Up @@ -162,7 +167,7 @@ func main() {
errs := RunAllDumpTasks(runner, basePath, *concurrentTasks, os.Stderr)

for _, err := range errs {
if ierr, ok := err.(IgnorableError); ok && ierr.Ignore() {
if ierr, ok := err.(IgnorableError); !showAllErrors && ok && ierr.Ignore() {
fileOnlyLogger.Printf("Task error: %v", err)
continue
}
Expand Down

0 comments on commit 146b6e4

Please sign in to comment.