diff options
| author | Paul Buetow <paul@buetow.org> | 2021-11-02 08:11:40 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2021-11-02 08:11:40 +0200 |
| commit | 1ec88deea93047a9d1a366e032b2a54aa3cd362b (patch) | |
| tree | 465f30673aa097a2b369e7c3d2032b041ff4f8e6 /internal/io/dlog/loggers/stdout.go | |
| parent | 2e9ce81c47d45dd1f2c607df6e19bdfdc3bb3cc8 (diff) | |
Bugfix: Dealing correctly with files without newline characters, also add more tests
Diffstat (limited to 'internal/io/dlog/loggers/stdout.go')
| -rw-r--r-- | internal/io/dlog/loggers/stdout.go | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/internal/io/dlog/loggers/stdout.go b/internal/io/dlog/loggers/stdout.go index 05485c6..0369ed7 100644 --- a/internal/io/dlog/loggers/stdout.go +++ b/internal/io/dlog/loggers/stdout.go @@ -25,14 +25,22 @@ func (s *stdout) Start(ctx context.Context, wg *sync.WaitGroup) { } func (s *stdout) Log(now time.Time, message string) { - s.log(message) + s.log(message, true) } func (s *stdout) LogWithColors(now time.Time, message, coloredMessage string) { - s.log(coloredMessage) + s.log(coloredMessage, true) } -func (s *stdout) log(message string) { +func (s *stdout) Raw(now time.Time, message string) { + s.log(message, false) +} + +func (s *stdout) RawWithColors(now time.Time, message, coloredMessage string) { + s.log(coloredMessage, false) +} + +func (s *stdout) log(message string, nl bool) { s.mutex.Lock() defer s.mutex.Unlock() @@ -43,7 +51,11 @@ func (s *stdout) log(message string) { default: } - fmt.Println(message) + if nl { + fmt.Println(message) + return + } + fmt.Print(message) } func (s *stdout) Pause() { s.pauseCh <- struct{}{} } |
