File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -30,9 +30,13 @@ type ContextModifier func(context.Context) context.Context
3030// zero or more `io.Writer` objects to the function. 
3131// 
3232// If no `io.Writer` objects are supplied, gdt will output debug messages using 
33- // the `testing.T.Log[f]()` function. This means that you will only get these 
34- // debug messages if you call the `go test` tool with the `-v` option (either 
35- // as `go test -v` or with `go test -v=test2json`. 
33+ // the `fmt.Printf` function. The `fmt.Printf` function is *unbuffered* however 
34+ // unless you call `go test` with the `-v` argument, `go test` swallows output 
35+ // to stdout and does not display it unless a test fails. 
36+ // 
37+ // This means that you will only get these debug messages if you call the `go 
38+ // test` tool with the `-v` option (either as `go test -v` or with `go test 
39+ // -v=test2json`. 
3640// 
3741// ```go 
3842// 
@@ -76,9 +80,8 @@ type ContextModifier func(context.Context) context.Context
7680func  WithDebug (writers  ... io.Writer ) ContextModifier  {
7781	return  func (ctx  context.Context ) context.Context  {
7882		if  len (writers ) ==  0  {
79- 			// This simply triggers a call to t.Logf() when WithDebug() is 
80- 			// called with no parameters... 
81- 			writers  =  []io.Writer {io .Discard }
83+ 			// Write to stdout when WithDebug() is called with no parameters 
84+ 			writers  =  []io.Writer {os .Stdout }
8285		}
8386		return  context .WithValue (ctx , debugKey , writers )
8487	}
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments