File tree 1 file changed +16
-1
lines changed
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) {
1167
1167
reader := bufio .NewReaderSize (r , c .config .PluginLogBufferSize )
1168
1168
// continuation indicates the previous line was a prefix
1169
1169
continuation := false
1170
+ // panic indicates the previous line was the start of a panic output
1171
+ panic := false
1170
1172
1171
1173
for {
1172
1174
line , isPrefix , err := reader .ReadLine ()
@@ -1203,19 +1205,32 @@ func (c *Client) logStderr(name string, r io.Reader) {
1203
1205
// string prefixes
1204
1206
switch line := string (line ); {
1205
1207
case strings .HasPrefix (line , "[TRACE]" ):
1208
+ panic = false
1206
1209
l .Trace (line )
1207
1210
case strings .HasPrefix (line , "[DEBUG]" ):
1211
+ panic = false
1208
1212
l .Debug (line )
1209
1213
case strings .HasPrefix (line , "[INFO]" ):
1214
+ panic = false
1210
1215
l .Info (line )
1211
1216
case strings .HasPrefix (line , "[WARN]" ):
1217
+ panic = false
1212
1218
l .Warn (line )
1213
1219
case strings .HasPrefix (line , "[ERROR]" ):
1220
+ panic = false
1221
+ l .Error (line )
1222
+ case strings .HasPrefix (line , "panic:" ):
1223
+ panic = true
1214
1224
l .Error (line )
1215
1225
default :
1216
- l .Debug (line )
1226
+ if panic {
1227
+ l .Error (line )
1228
+ } else {
1229
+ l .Debug (line )
1230
+ }
1217
1231
}
1218
1232
} else {
1233
+ panic = false
1219
1234
out := flattenKVPairs (entry .KVPairs )
1220
1235
1221
1236
out = append (out , "timestamp" , entry .Timestamp .Format (hclog .TimeFormat ))
You can’t perform that action at this time.
0 commit comments