diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2018-08-09 20:29:58 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2018-08-09 20:29:58 +1000 |
commit | 44eaccfd1490db54a419b9a367d10e05f94927e1 (patch) | |
tree | 86489050e26575fb9a9550da3c0a31a12f757f3c /main.go | |
parent | 9537645d0cfdac87addd4c9a5eb0e7df3bac8ee8 (diff) |
switch to using the log package rather than directly writing to file
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 15 |
1 files changed, 5 insertions, 10 deletions
@@ -11,7 +11,6 @@ import ( "os/user" "path/filepath" - "github.com/fatih/color" "github.com/jesseduffield/gocui" git "gopkg.in/src-d/go-git.v4" ) @@ -45,18 +44,14 @@ func projectPath(path string) string { } func devLog(objects ...interface{}) { - localLog(color.FgWhite, "development.log", objects...) -} - -func colorLog(colour color.Attribute, objects ...interface{}) { - localLog(colour, "development.log", objects...) + localLog("development.log", objects...) } func commandLog(objects ...interface{}) { - localLog(color.FgWhite, "commands.log", objects...) + localLog("commands.log", objects...) } -func localLog(colour color.Attribute, path string, objects ...interface{}) { +func localLog(path string, objects ...interface{}) { if !*debuggingFlag { return } @@ -65,9 +60,9 @@ func localLog(colour color.Attribute, path string, objects ...interface{}) { panic(err.Error()) } defer f.Close() + log.SetOutput(f) for _, object := range objects { - colorFunction := color.New(colour).SprintFunc() - f.WriteString(colorFunction(fmt.Sprint(object)) + "\n") + log.Println(fmt.Sprint(object)) } } |