fix: incorrect typing
This commit is contained in:
parent
1ebe62869b
commit
53c4751f31
1 changed files with 14 additions and 13 deletions
27
src/main.zig
27
src/main.zig
|
@ -11,12 +11,11 @@ pub fn log(
|
|||
/// The length of the buffer used for the formatted output.
|
||||
/// This is the maximum length of log messages.
|
||||
comptime buf_size: usize,
|
||||
) fn (
|
||||
comptime std.log.Level,
|
||||
comptime @TypeOf(.EnumLiteral),
|
||||
comptime format: []const u8,
|
||||
anytype,
|
||||
) void {
|
||||
) @TypeOf(LogStruct(c, module_name, buf_size).log) {
|
||||
return LogStruct(c, module_name, buf_size).log;
|
||||
}
|
||||
|
||||
fn LogStruct(c: anytype, comptime module_name: []const u8, comptime buf_size: usize) type {
|
||||
return struct {
|
||||
pub fn log(
|
||||
comptime level: std.log.Level,
|
||||
|
@ -44,7 +43,14 @@ pub fn log(
|
|||
var fields = [_]c.GLogField{
|
||||
c.GLogField{
|
||||
.key = "GLIB_DOMAIN",
|
||||
.value = module_name ++ "-" ++ @tagName(scope),
|
||||
.value = @ptrCast(
|
||||
*const anyopaque,
|
||||
// don't include scope name if not explicitly specified
|
||||
if (std.mem.eql(u8, @tagName(scope), "default"))
|
||||
module_name
|
||||
else
|
||||
module_name ++ "-" ++ @tagName(scope),
|
||||
),
|
||||
.length = -1,
|
||||
},
|
||||
c.GLogField{
|
||||
|
@ -60,10 +66,5 @@ pub fn log(
|
|||
fields.len,
|
||||
);
|
||||
}
|
||||
}.log;
|
||||
};
|
||||
}
|
||||
|
||||
export fn add(a: i32, b: i32) i32 {
|
||||
return a + b;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue