diff options
author | Andrew Newdigate <andrew@troupe.co> | 2017-06-07 14:11:07 +0300 |
---|---|---|
committer | Andrew Newdigate <andrew@troupe.co> | 2017-06-07 14:11:07 +0300 |
commit | 703ade86df8cfd09ea0ced2ce0ef145091194dd5 (patch) | |
tree | 3a78a2d9b32ce21e9307ac1e5a0b276e99952d92 /internal/config | |
parent | 676a6510c61379a4db12b4820aab08a418519f0b (diff) |
Debug logging fix
Diffstat (limited to 'internal/config')
-rw-r--r-- | internal/config/logger.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/internal/config/logger.go b/internal/config/logger.go index c32c3ca47..97522e099 100644 --- a/internal/config/logger.go +++ b/internal/config/logger.go @@ -6,6 +6,10 @@ import ( log "github.com/sirupsen/logrus" ) +var ( + debugLoggingEnabled = os.Getenv("GITALY_DEBUG") == "1" +) + func init() { // This ensures that any log statements that occur before // the configuration has been loaded will be written to @@ -26,9 +30,14 @@ func configureLoggingFormat() { } } +// IsDebugLoggingEnabled returns true is debug logging is disabled +func IsDebugLoggingEnabled() bool { + return debugLoggingEnabled +} + // ConfigureLogging uses the global conf and environmental vars to configure the logged func ConfigureLogging() { - if os.Getenv("GITALY_DEBUG") != "1" { + if IsDebugLoggingEnabled() { log.SetLevel(log.DebugLevel) } else { log.SetLevel(log.InfoLevel) |