From 38e6973bf7948c55b344b5a3957cf220b79f0d99 Mon Sep 17 00:00:00 2001 From: Slach Date: Thu, 8 Aug 2024 10:59:18 +0400 Subject: [PATCH] remove github.com/Altinity/clickhouse-backup/v2/ from logging --- cmd/clickhouse-backup/main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/clickhouse-backup/main.go b/cmd/clickhouse-backup/main.go index 07e110db..ea12d0f9 100644 --- a/cmd/clickhouse-backup/main.go +++ b/cmd/clickhouse-backup/main.go @@ -5,6 +5,7 @@ import ( "fmt" stdlog "log" "os" + "strconv" "strings" "github.com/rs/zerolog" @@ -27,6 +28,10 @@ var ( func main() { zerolog.TimeFieldFormat = zerolog.TimeFormatUnixMs zerolog.ErrorStackMarshaler = pkgerrors.MarshalStack + // Customize the caller format to remove the prefix + zerolog.CallerMarshalFunc = func(pc uintptr, file string, line int) string { + return strings.TrimPrefix(file, "github.com/Altinity/clickhouse-backup/v2/") + ":" + strconv.Itoa(line) + } consoleWriter := zerolog.ConsoleWriter{Out: os.Stderr, NoColor: true, TimeFormat: "2006-01-02 15:04:05.000"} //diodeWriter := diode.NewWriter(consoleWriter, 4096, 10*time.Millisecond, func(missed int) { // fmt.Printf("Logger Dropped %d messages", missed)