diff --git a/nav.go b/nav.go index 0aca05c..e37e63b 100644 --- a/nav.go +++ b/nav.go @@ -117,7 +117,7 @@ func organizeFiles(fi []os.FileInfo) []os.FileInfo { func newDir(path string) *Dir { fi, err := ioutil.ReadDir(path) if err != nil { - log.Print(err) + log.Printf("reading directory: %s", err) } fi = organizeFiles(fi) @@ -131,7 +131,7 @@ func newDir(path string) *Dir { func (dir *Dir) renew(height int) { fi, err := ioutil.ReadDir(dir.path) if err != nil { - log.Print(err) + log.Print("reading directory: %s", err) } fi = organizeFiles(fi) @@ -205,7 +205,7 @@ func getDirs(wd string, height int) []*Dir { func newNav(height int) *Nav { wd, err := os.Getwd() if err != nil { - log.Print(err) + log.Printf("getting current directory: %s", err) } dirs := getDirs(wd, height) diff --git a/ui.go b/ui.go index 60d746f..99250ac 100644 --- a/ui.go +++ b/ui.go @@ -307,8 +307,9 @@ func (ui *UI) draw(nav *Nav) { f, err := os.Stat(path) if err != nil { - ui.message = err.Error() - log.Print(err) + msg := fmt.Sprintf("getting file information: %s", err) + ui.message = msg + log.Print(msg) return } @@ -319,8 +320,9 @@ func (ui *UI) draw(nav *Nav) { } else if f.Mode().IsRegular() { file, err := os.Open(path) if err != nil { - ui.message = err.Error() - log.Print(err) + msg := fmt.Sprintf("opening file: %s", err) + ui.message = msg + log.Print(msg) } if err := preview.printr(file); err != nil { @@ -472,14 +474,14 @@ func (ui *UI) pause() { func (ui *UI) resume() { if err := termbox.Init(); err != nil { - log.Fatal(err) + log.Fatalf("initializing termbox: %s", err) } } func (ui *UI) sync() { err := termbox.Sync() if err != nil { - log.Printf("syncing: %s", err) + log.Printf("syncing termbox: %s", err) } termbox.SetCursor(0, 0) termbox.HideCursor()