Add initial wlr_log bindings

These do not expose all functionality. Eventually I'd like to integrate
with zig's std.log by default.
This commit is contained in:
Isaac Freund 2020-10-16 12:02:55 +02:00
parent 8b0ade0ca3
commit fa8f24166d
No known key found for this signature in database
GPG key ID: 86DED400DDFD7A11
2 changed files with 22 additions and 0 deletions

21
src/util/log.zig Normal file
View file

@ -0,0 +1,21 @@
pub const Importance = extern enum {
silent = 0,
err = 1,
info = 2,
debug = 3,
last,
};
// TODO: callback is really a
// typedef void (*wlr_log_func_t)(enum wlr_log_importance importance,
// const char *fmt, va_list args);
// but zig doesn't have good varargs support yet, so use a void pointer for
// now and always pass null, indicating that the default log function
// should be used.
extern fn wlr_log_init(verbosity: Importance, callback: ?*c_void) void;
pub fn init(verbosity: Importance) void {
wlr_log_init(verbosity, null);
}
extern fn wlr_log_get_verbosity() Importance;
pub const getVerbosity = wlr_log_get_verbosity;

View file

@ -43,3 +43,4 @@ pub const XCursorManager = @import("types/xcursor_manager.zig").XCursorManager;
pub const XCursorManagerTheme = @import("types/xcursor_manager.zig").XCursorManagerTheme;
pub const Edges = @import("util/edges.zig").Edges;
pub const log = @import("util/log.zig");