Skip to content

Commit

Permalink
get some logging going
Browse files Browse the repository at this point in the history
  • Loading branch information
donpdonp committed Jul 13, 2024
1 parent 56b8bf7 commit cf9e1e4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/db/lmdb.zig
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub fn init(allocator: Allocator) !void {
pub fn stats() void {
var mdbStat: c.MDB_stat = undefined;
_ = c.mdb_env_stat(env, &mdbStat);
warn("lmdb cache {} entries\n", .{mdbStat.ms_entries});
util.log("lmdb cache {} entries\n", .{mdbStat.ms_entries});
}

pub fn write(namespace: []const u8, key: []const u8, value: []const u8, allocator: Allocator) !void {
Expand Down
1 change: 1 addition & 0 deletions src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pub fn main() !void {
_ = thread.create("gui", gui.go, dummy_payload, guiback) catch unreachable;
_ = thread.create("heartbeat", heartbeat.go, dummy_payload, heartback) catch unreachable;
while (true) {
util.log("while", .{});
statewalk(alloc);
util.log("thread.wait()/epoll", .{});
thread.wait(); // main ipc listener
Expand Down
6 changes: 1 addition & 5 deletions src/util.zig
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@ pub fn log(comptime msg: []const u8, args: anytype) void {
var tz = std.posix.timezone{ .tz_minuteswest = 0, .tz_dsttime = 0 };
std.posix.gettimeofday(null, &tz); // does not set tz
const time_str = "Z"; //std.fmt.allocPrint(alloc, "{d}-{d:0>2}-{d:0>2} {d:0>2}:{d:0>2}:{d:0>2}", .{ yday.year, mday.month.numeric(), mday.day_index + 1, dsec.getHoursIntoDay(), dsec.getMinutesIntoHour(), dsec.getSecondsIntoMinute() }) catch unreachable;
_ = time_str;
_ = tid_name;
_ = msg;
_ = args;
//std.debug.print("{s}[tid#{d}/{s:9}] " ++ msg ++ "\n", .{ time_str, tid, tid_name } ++ args);
std.debug.print("{s}[tid#{d}/{s:9}] " ++ msg ++ "\n", .{ time_str, tid, tid_name } ++ args);
}

pub fn hashIdSame(comptime T: type, a: T, b: T) bool {
Expand Down

0 comments on commit cf9e1e4

Please sign in to comment.