From 36319adace59e3ded60dd8164145d5da8f4fdf62 Mon Sep 17 00:00:00 2001 From: Paul Kuruvilla Date: Tue, 21 May 2024 01:38:54 +0100 Subject: [PATCH] Refactor Plainf method in logger.go to print each line separately --- logger/logger.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/logger/logger.go b/logger/logger.go index 966a18f..b2c461c 100644 --- a/logger/logger.go +++ b/logger/logger.go @@ -181,7 +181,11 @@ func (l *Logger) Debugln(msg string) { } func (l *Logger) Plainf(fstring string, args ...interface{}) { - l.logger.Printf(fstring, args...) + formattedString := fmt.Sprintf(fstring, args...) + + for _, line := range strings.Split(formattedString, "\n") { + l.logger.Println(line) + } } func (l *Logger) Plainln(msg string) {