summaryrefslogtreecommitdiffstats
path: root/pkg/config
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2023-05-25 18:18:35 +1000
committerJesse Duffield <jessedduffield@gmail.com>2023-05-25 18:31:32 +1000
commite0ecc9e835ef56fae7ee58408ba91e29f000344d (patch)
tree94308647a248d326c1e0cdb863623cfe63b7d66b /pkg/config
parent1f8e838052a1bc083cb50560431b2f115df8acb6 (diff)
Allow global logging when developing
I'll be honest, for all I know logging should be global in general: it is a pain to pass a logger to any struct that needs it. But smart people on the internet tell me otherwise, and I do like the idea of not having any global variables lying around. Nonetheless, I often need to log things when locally debugging and that's a different kind of logging than the kind you would include in the actual released binary. For example if I want to log something from gocui, I would rather not have gocui depend on lazygit's logging setup.
Diffstat (limited to 'pkg/config')
-rw-r--r--pkg/config/app_config.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/config/app_config.go b/pkg/config/app_config.go
index 49ff32b04..27e3b1400 100644
--- a/pkg/config/app_config.go
+++ b/pkg/config/app_config.go
@@ -301,5 +301,9 @@ func getDefaultAppState() *AppState {
}
func LogPath() (string, error) {
+ if os.Getenv("LAZYGIT_LOG_PATH") != "" {
+ return os.Getenv("LAZYGIT_LOG_PATH"), nil
+ }
+
return configFilePath("development.log")
}