diff options
author | 2021-05-13 01:24:10 -0700 | |
---|---|---|
committer | 2021-05-13 01:24:10 -0700 | |
commit | f6f40b5b649507aee7555123e93a1b474b92f598 (patch) | |
tree | 6e262b821e6c5d62a089a3b03090335bbe622a55 /src/logger.zig | |
parent | bed0227a8f2d8b674a98803659922d08ac665bfe (diff) | |
download | bun-f6f40b5b649507aee7555123e93a1b474b92f598.tar.gz bun-f6f40b5b649507aee7555123e93a1b474b92f598.tar.zst bun-f6f40b5b649507aee7555123e93a1b474b92f598.zip |
various bug fixes
Former-commit-id: 87771ba895a2eb11b042a252fd1dff2a4dd54512
Diffstat (limited to 'src/logger.zig')
-rw-r--r-- | src/logger.zig | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/logger.zig b/src/logger.zig index a07adc203..72c7ebc3d 100644 --- a/src/logger.zig +++ b/src/logger.zig @@ -140,15 +140,22 @@ pub const Msg = struct { msg: *const Msg, to: anytype, ) !void { - try std.fmt.format(to, "\n\n{s}: {s}\n{s}\n{s}:{}:{} {d}", .{ - msg.kind.string(), - msg.data.text, - msg.data.location.?.line_text, - msg.data.location.?.file, - msg.data.location.?.line, - msg.data.location.?.column, - msg.data.location.?.offset, - }); + if (msg.data.location) |location| { + try std.fmt.format(to, "\n\n{s}: {s}\n{s}\n{s}:{}:{} {d}", .{ + msg.kind.string(), + msg.data.text, + location.line_text, + location.file, + location.line, + location.column, + location.offset, + }); + } else { + try std.fmt.format(to, "\n\n{s}: {s}\n", .{ + msg.kind.string(), + msg.data.text, + }); + } } pub fn doFormat(msg: *const Msg, to: anytype, formatterFunc: anytype) !void { |