Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Newdigate <andrew@troupe.co>2017-06-07 14:11:07 +0300
committerAndrew Newdigate <andrew@troupe.co>2017-06-07 14:11:07 +0300
commit703ade86df8cfd09ea0ced2ce0ef145091194dd5 (patch)
tree3a78a2d9b32ce21e9307ac1e5a0b276e99952d92 /internal/config
parent676a6510c61379a4db12b4820aab08a418519f0b (diff)
Debug logging fix
Diffstat (limited to 'internal/config')
-rw-r--r--internal/config/logger.go11
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)