1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-31 14:24:25 +03:00

don't call projectPath until we know we're in debug mode

This commit is contained in:
Jesse Duffield
2018-08-09 13:37:48 +10:00
parent 750445dc8b
commit bebe94b4b3

View File

@ -44,22 +44,22 @@ func projectPath(path string) string {
} }
func devLog(objects ...interface{}) { func devLog(objects ...interface{}) {
localLog(color.FgWhite, projectPath("development.log"), objects...) localLog(color.FgWhite, "development.log", objects...)
} }
func colorLog(colour color.Attribute, objects ...interface{}) { func colorLog(colour color.Attribute, objects ...interface{}) {
localLog(colour, projectPath("development.log"), objects...) localLog(colour, "development.log", objects...)
} }
func commandLog(objects ...interface{}) { func commandLog(objects ...interface{}) {
localLog(color.FgWhite, projectPath("commands.log"), objects...) localLog(color.FgWhite, "commands.log", objects...)
} }
func localLog(colour color.Attribute, path string, objects ...interface{}) { func localLog(colour color.Attribute, path string, objects ...interface{}) {
if !*debuggingFlag { if !*debuggingFlag {
return return
} }
f, _ := os.OpenFile(path, os.O_APPEND|os.O_WRONLY, 0644) f, _ := os.OpenFile(projectPath(path), os.O_APPEND|os.O_WRONLY, 0644)
defer f.Close() defer f.Close()
for _, object := range objects { for _, object := range objects {
colorFunction := color.New(colour).SprintFunc() colorFunction := color.New(colour).SprintFunc()