code: improve logging functions

this implements a modified version of the logging interface proposed
here: https://github.com/ziglang/zig/pull/5348
This commit is contained in:
Isaac Freund
2020-06-17 01:25:11 +02:00
parent 42f8076cec
commit d74323bbbf
18 changed files with 207 additions and 92 deletions

View File

@ -18,9 +18,9 @@
const std = @import("std");
const c = @import("c.zig");
const log = @import("log.zig");
const util = @import("util.zig");
const Log = @import("log.zig").Log;
const Server = @import("Server.zig");
const usage: []const u8 =
@ -58,10 +58,9 @@ pub fn main() !void {
}
}
Log.init(Log.Debug);
c.wlr_log_init(.WLR_ERROR, null);
Log.Info.log("Initializing server", .{});
log.info(.server, "initializing", .{});
var server: Server = undefined;
try server.init();
@ -76,9 +75,9 @@ pub fn main() !void {
try std.ChildProcess.spawn(child);
}
Log.Info.log("Running server...", .{});
log.info(.server, "running...", .{});
server.run();
Log.Info.log("Shutting down server", .{});
log.info(.server, "shutting down", .{});
}