From 0140e19eb2a607dd00f68b593602c07fca582006 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sat, 15 Aug 2026 08:03:32 +0200 Subject: [PATCH] Separate the runs in the debug log with a blank line This makes it much easier to find where a new run starts; previously you had to search for `git --version` for that. --- pkg/logs/logs.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/logs/logs.go b/pkg/logs/logs.go index c43d0fe5e..40fc207c5 100644 --- a/pkg/logs/logs.go +++ b/pkg/logs/logs.go @@ -4,6 +4,7 @@ import ( "io" "log" "os" + "sync" "time" "github.com/sirupsen/logrus" @@ -35,6 +36,11 @@ func NewProductionLogger() *logrus.Entry { return formatted(logger) } +// Separates one run's log entries from the previous run's. Only the first +// logger of a run writes it: with LAZYGIT_LOG_PATH set there are two of them +// for the same file, the global one and the app's. +var runSeparator sync.Once + func NewDevelopmentLogger(logPath string) *logrus.Entry { logger := logrus.New() logger.SetLevel(getLogLevel()) @@ -43,6 +49,9 @@ func NewDevelopmentLogger(logPath string) *logrus.Entry { if err != nil { log.Fatalf("Unable to log to log file: %v", err) } + runSeparator.Do(func() { + _, _ = file.WriteString("\n") + }) logger.SetOutput(file) return formatted(logger) }