authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-11-24 23:08:37-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-11-24 23:08:37-07:00
log078a7ff198c46aea98b8837ae9fab52626dd01a0
tree67cef0500968e639f4735b6b9210c959d0bbdd25
parent6b87f0dc56b82c2f27d70271626480d21a4d0d66

Cache: add debug log statement


1 files changed, 4 insertions(+), 2 deletions(-)

src/Cache.zig+4-2
...@@ -13,6 +13,7 @@ const mem = std.mem;...@@ -13,6 +13,7 @@ const mem = std.mem;
13const fmt = std.fmt;13const fmt = std.fmt;
14const Allocator = std.mem.Allocator;14const Allocator = std.mem.Allocator;
15const Compilation = @import("Compilation.zig");15const Compilation = @import("Compilation.zig");
16const log = std.log.scoped(.cache);
1617
17/// Be sure to call `Manifest.deinit` after successful initialization.18/// Be sure to call `Manifest.deinit` after successful initialization.
18pub fn obtain(cache: *const Cache) Manifest {19pub fn obtain(cache: *const Cache) Manifest {
...@@ -478,6 +479,7 @@ pub const Manifest = struct {...@@ -478,6 +479,7 @@ pub const Manifest = struct {
478 }479 }
479480
480 fn populateFileHash(self: *Manifest, ch_file: *File) !void {481 fn populateFileHash(self: *Manifest, ch_file: *File) !void {
482 log.debug("populateFileHash {s}", .{ch_file.path.?});
481 const file = try fs.cwd().openFile(ch_file.path.?, .{});483 const file = try fs.cwd().openFile(ch_file.path.?, .{});
482 defer file.close();484 defer file.close();
483485
...@@ -581,7 +583,7 @@ pub const Manifest = struct {...@@ -581,7 +583,7 @@ pub const Manifest = struct {
581 .target, .target_must_resolve, .prereq => {},583 .target, .target_must_resolve, .prereq => {},
582 else => |err| {584 else => |err| {
583 try err.printError(error_buf.writer());585 try err.printError(error_buf.writer());
584 std.log.err("failed parsing {s}: {s}", .{ dep_file_basename, error_buf.items });586 log.err("failed parsing {s}: {s}", .{ dep_file_basename, error_buf.items });
585 return error.InvalidDepFile;587 return error.InvalidDepFile;
586 },588 },
587 }589 }
...@@ -593,7 +595,7 @@ pub const Manifest = struct {...@@ -593,7 +595,7 @@ pub const Manifest = struct {
593 .prereq => |bytes| try self.addFilePost(bytes),595 .prereq => |bytes| try self.addFilePost(bytes),
594 else => |err| {596 else => |err| {
595 try err.printError(error_buf.writer());597 try err.printError(error_buf.writer());
596 std.log.err("failed parsing {s}: {s}", .{ dep_file_basename, error_buf.items });598 log.err("failed parsing {s}: {s}", .{ dep_file_basename, error_buf.items });
597 return error.InvalidDepFile;599 return error.InvalidDepFile;
598 },600 },
599 }601 }