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:
-rw-r--r--changelogs/unreleased/sh-standardize-praefect-log-format.yml5
-rw-r--r--cmd/gitaly-wrapper/main.go3
-rw-r--r--internal/log/log.go9
3 files changed, 14 insertions, 3 deletions
diff --git a/changelogs/unreleased/sh-standardize-praefect-log-format.yml b/changelogs/unreleased/sh-standardize-praefect-log-format.yml
new file mode 100644
index 000000000..fe7f610a2
--- /dev/null
+++ b/changelogs/unreleased/sh-standardize-praefect-log-format.yml
@@ -0,0 +1,5 @@
+---
+title: Standardize Praefect and Gitaly log formats
+merge_request: 3121
+author:
+type: changed
diff --git a/cmd/gitaly-wrapper/main.go b/cmd/gitaly-wrapper/main.go
index e31c9e2e0..1a9ee929a 100644
--- a/cmd/gitaly-wrapper/main.go
+++ b/cmd/gitaly-wrapper/main.go
@@ -13,6 +13,7 @@ import (
"github.com/sirupsen/logrus"
"gitlab.com/gitlab-org/gitaly/internal/bootstrap"
+ "gitlab.com/gitlab-org/gitaly/internal/log"
"gitlab.com/gitlab-org/gitaly/internal/ps"
)
@@ -22,7 +23,7 @@ const (
func main() {
if jsonLogging() {
- logrus.SetFormatter(&logrus.JSONFormatter{})
+ logrus.SetFormatter(&logrus.JSONFormatter{TimestampFormat: log.LogTimestampFormat})
}
if len(os.Args) < 2 {
diff --git a/internal/log/log.go b/internal/log/log.go
index 1e3a251f5..c82da9124 100644
--- a/internal/log/log.go
+++ b/internal/log/log.go
@@ -6,7 +6,12 @@ import (
"github.com/sirupsen/logrus"
)
-const GitalyLogDirEnvKey = "GITALY_LOG_DIR"
+const (
+ // GitalyLogDirEnvKey defines the environment variable used to specify the Gitaly log directory
+ GitalyLogDirEnvKey = "GITALY_LOG_DIR"
+ // LogTimestampFormat defines the timestamp format in log files
+ LogTimestampFormat = "2006-01-02T15:04:05.000Z"
+)
var (
defaultLogger = logrus.StandardLogger()
@@ -32,7 +37,7 @@ func Configure(format string, level string) {
switch format {
case "json":
for _, l := range Loggers {
- l.Formatter = &logrus.JSONFormatter{TimestampFormat: "2006-01-02T15:04:05.000Z"}
+ l.Formatter = &logrus.JSONFormatter{TimestampFormat: LogTimestampFormat}
}
case "":
// Just stick with the default