File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -503,12 +503,24 @@ func Test_StartLogProductionStillStartsWithTooHighTimeout(t *testing.T) {
503
503
504
504
// bufLogger is a Logging implementation that writes to a bytes.Buffer.
505
505
type bufLogger struct {
506
- bytes.Buffer
506
+ mtx sync.Mutex
507
+ buf bytes.Buffer
507
508
}
508
509
509
510
// Printf implements Logging.
510
511
func (l * bufLogger ) Printf (format string , v ... any ) {
511
- fmt .Fprintf (l , format , v ... )
512
+ l .mtx .Lock ()
513
+ defer l .mtx .Unlock ()
514
+
515
+ fmt .Fprintf (& l .buf , format , v ... )
516
+ }
517
+
518
+ // String returns the contents of the buffer as a string.
519
+ func (l * bufLogger ) String () string {
520
+ l .mtx .Lock ()
521
+ defer l .mtx .Unlock ()
522
+
523
+ return l .buf .String ()
512
524
}
513
525
514
526
func Test_MultiContainerLogConsumer_CancelledContext (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments