From d298a7ce4bfacaaf4447dcbf546bc0edd577166b Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sat, 15 Aug 2026 07:35:23 +0200 Subject: [PATCH] Use nano-second time stamp granularity in the debug log It's overkill for most purposes, but I'd say it doesn't hurt to have the extra resolution available in the raw JSON data for the few cases where it's useful. Have "lazygit -l" print them with milli-second resolution; that seems to be a good middle ground. --- pkg/logs/logs.go | 3 ++- pkg/logs/tail/tail.go | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/logs/logs.go b/pkg/logs/logs.go index 7ec1b91b4..c43d0fe5e 100644 --- a/pkg/logs/logs.go +++ b/pkg/logs/logs.go @@ -4,6 +4,7 @@ import ( "io" "log" "os" + "time" "github.com/sirupsen/logrus" ) @@ -49,7 +50,7 @@ func NewDevelopmentLogger(logPath string) *logrus.Entry { func formatted(log *logrus.Logger) *logrus.Entry { // highly recommended: tail -f development.log | humanlog // https://github.com/aybabtme/humanlog - log.Formatter = &logrus.JSONFormatter{} + log.Formatter = &logrus.JSONFormatter{TimestampFormat: time.RFC3339Nano} return log.WithFields(logrus.Fields{}) } diff --git a/pkg/logs/tail/tail.go b/pkg/logs/tail/tail.go index b21bc21e4..1cc5ef05e 100644 --- a/pkg/logs/tail/tail.go +++ b/pkg/logs/tail/tail.go @@ -4,6 +4,7 @@ import ( "fmt" "log" "os" + "time" "github.com/aybabtme/humanlog" ) @@ -15,6 +16,7 @@ func TailLogs(logFilePath string) { opts := humanlog.DefaultOptions opts.Truncates = false + opts.TimeFormat = time.StampMilli _, err := os.Stat(logFilePath) if err != nil {