mirror of
https://github.com/swaywm/zig-wlroots
synced 2024-09-29 05:36:47 +02:00
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:
parent
8b0ade0ca3
commit
fa8f24166d
2 changed files with 22 additions and 0 deletions
21
src/util/log.zig
Normal file
21
src/util/log.zig
Normal 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;
|
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue