File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -1167,6 +1167,8 @@ func (c *Client) logStderr(name string, r io.Reader) {
11671167 reader := bufio .NewReaderSize (r , c .config .PluginLogBufferSize )
11681168 // continuation indicates the previous line was a prefix
11691169 continuation := false
1170+ // panic indicates the previous line was the start of a panic output
1171+ panic := false
11701172
11711173 for {
11721174 line , isPrefix , err := reader .ReadLine ()
@@ -1203,19 +1205,32 @@ func (c *Client) logStderr(name string, r io.Reader) {
12031205 // string prefixes
12041206 switch line := string (line ); {
12051207 case strings .HasPrefix (line , "[TRACE]" ):
1208+ panic = false
12061209 l .Trace (line )
12071210 case strings .HasPrefix (line , "[DEBUG]" ):
1211+ panic = false
12081212 l .Debug (line )
12091213 case strings .HasPrefix (line , "[INFO]" ):
1214+ panic = false
12101215 l .Info (line )
12111216 case strings .HasPrefix (line , "[WARN]" ):
1217+ panic = false
12121218 l .Warn (line )
12131219 case strings .HasPrefix (line , "[ERROR]" ):
1220+ panic = false
1221+ l .Error (line )
1222+ case strings .HasPrefix (line , "panic:" ):
1223+ panic = true
12141224 l .Error (line )
12151225 default :
1216- l .Debug (line )
1226+ if panic {
1227+ l .Error (line )
1228+ } else {
1229+ l .Debug (line )
1230+ }
12171231 }
12181232 } else {
1233+ panic = false
12191234 out := flattenKVPairs (entry .KVPairs )
12201235
12211236 out = append (out , "timestamp" , entry .Timestamp .Format (hclog .TimeFormat ))
You can’t perform that action at this time.
0 commit comments