chore: move fmt_buf into LogStruct
This commit is contained in:
parent
2b35755f6c
commit
d897a7ee86
1 changed files with 3 additions and 5 deletions
|
@ -17,16 +17,14 @@ pub fn log(
|
|||
|
||||
fn LogStruct(c: anytype, comptime module_name: []const u8, comptime buf_size: usize) type {
|
||||
return struct {
|
||||
threadlocal var fmt_buf: [buf_size]u8 = undefined;
|
||||
|
||||
pub fn log(
|
||||
comptime level: std.log.Level,
|
||||
comptime scope: @TypeOf(.EnumLiteral),
|
||||
comptime format: []const u8,
|
||||
args: anytype,
|
||||
) void {
|
||||
const Buf = struct {
|
||||
pub threadlocal var fmt_buf: [buf_size]u8 = undefined;
|
||||
};
|
||||
|
||||
const g_level = switch (level) {
|
||||
.err => c.G_LOG_LEVEL_CRITICAL,
|
||||
.warn => c.G_LOG_LEVEL_WARNING,
|
||||
|
@ -35,7 +33,7 @@ fn LogStruct(c: anytype, comptime module_name: []const u8, comptime buf_size: us
|
|||
};
|
||||
|
||||
const s = std.fmt.bufPrintZ(
|
||||
&Buf.fmt_buf,
|
||||
&@This().fmt_buf,
|
||||
format,
|
||||
args,
|
||||
) catch return;
|
||||
|
|
Loading…
Reference in a new issue