@@ -73,11 +73,16 @@ func (t *basicTaskBase) startBasicTask() (err error) {
7373 var stdoutBuf , stderrBuf bytes.Buffer
7474 var stdout , stderr io.Writer
7575
76- if t .Tci .Log == nil {
76+ if t .Tci .Stdout == nil {
7777 none := "none"
78- t .Tci .Log = & none
78+ t .Tci .Stdout = & none
7979 }
80- switch * t .Tci .Log {
80+ if t .Tci .Stderr == nil {
81+ none := "none"
82+ t .Tci .Stderr = & none
83+ }
84+
85+ switch * t .Tci .Stdout {
8186 case "stdout" :
8287 stdoutLog := log .WithPrefix ("task-stdout" ).
8388 WithField ("level" , infologger .IL_Support ).
@@ -86,38 +91,49 @@ func (t *basicTaskBase) startBasicTask() (err error) {
8691 WithField ("task" , t .ti .Name ).
8792 WithField ("nohooks" , true ).
8893 WriterLevel (logrus .TraceLevel )
89- stderrLog := log .WithPrefix ("task-stderr" ).
94+
95+ // Each of these multiwriters will push incoming lines to a buffer as well as the logger
96+ stdout = io .MultiWriter (stdoutLog , & stdoutBuf )
97+
98+ case "all" :
99+ stdoutLog := log .WithPrefix ("task-stdout" ).
90100 WithField ("level" , infologger .IL_Support ).
91101 WithField ("partition" , t .knownEnvironmentId .String ()).
92102 WithField ("detector" , t .knownDetector ).
93103 WithField ("task" , t .ti .Name ).
94- WithField ("nohooks" , true ).
95104 WriterLevel (logrus .TraceLevel )
96-
97- // Each of these multiwriters will push incoming lines to a buffer as well as the logger
98105 stdout = io .MultiWriter (stdoutLog , & stdoutBuf )
99- stderr = io .MultiWriter (stderrLog , & stderrBuf )
100106
101- case "all" :
102- stdoutLog := log .WithPrefix ("task-stdout" ).
107+ default :
108+ // Nothing goes to the log, we go straight to the buffer
109+ stdout = & stdoutBuf
110+ }
111+
112+ switch * t .Tci .Stderr {
113+ case "stdout" :
114+ stderrLog := log .WithPrefix ("task-stderr" ).
103115 WithField ("level" , infologger .IL_Support ).
104116 WithField ("partition" , t .knownEnvironmentId .String ()).
105117 WithField ("detector" , t .knownDetector ).
106118 WithField ("task" , t .ti .Name ).
119+ WithField ("nohooks" , true ).
107120 WriterLevel (logrus .TraceLevel )
121+
122+ // Each of these multiwriters will push incoming lines to a buffer as well as the logger
123+ stderr = io .MultiWriter (stderrLog , & stderrBuf )
124+
125+ case "all" :
108126 stderrLog := log .WithPrefix ("task-stderr" ).
109127 WithField ("level" , infologger .IL_Support ).
110128 WithField ("partition" , t .knownEnvironmentId .String ()).
111129 WithField ("detector" , t .knownDetector ).
112130 WithField ("task" , t .ti .Name ).
113131 WriterLevel (logrus .TraceLevel )
114132
115- stdout = io .MultiWriter (stdoutLog , & stdoutBuf )
116133 stderr = io .MultiWriter (stderrLog , & stderrBuf )
117134
118135 default :
119136 // Nothing goes to the log, we go straight to the buffer
120- stdout = & stdoutBuf
121137 stderr = & stderrBuf
122138 }
123139
0 commit comments