loki level is error if unable to parse json

This commit is contained in:
Jeffrey C. Ollie 2023-10-15 15:30:11 -05:00
parent dab10464fe
commit 210dc72ca5
Signed by: jeff
GPG key ID: 6F86035A6D97044E

View file

@ -211,10 +211,13 @@ pub fn main() !void {
iperf3_log.err("error from iperf3: {s}", .{err}); iperf3_log.err("error from iperf3: {s}", .{err});
level = loki.LogLevel.@"error"; level = loki.LogLevel.@"error";
} }
} else |err| switch (err) { } else |err| {
error.UnknownField => iperf3_log.err("unknown field parsing json {d}", .{timestamp}), switch (err) {
error.UnexpectedEndOfInput => iperf3_log.err("unexpected end of input parsing json {d}", .{timestamp}), error.UnknownField => iperf3_log.err("unknown field parsing json {d}", .{timestamp}),
else => iperf3_log.err("other error while parsing json {} {d}", .{ err, timestamp }), error.UnexpectedEndOfInput => iperf3_log.err("unexpected end of input parsing json {d}", .{timestamp}),
else => iperf3_log.err("other error while parsing json {} {d}", .{ err, timestamp }),
}
level = loki.LogLevel.@"error";
} }
// var line = std.ArrayList(u8).init(allocator); // var line = std.ArrayList(u8).init(allocator);