zgpu

git clone git://git.electrosoup.com/zgpu
Log | Files | Refs | Submodules | README

logging.zig (589B)


      1 const std = @import("std");
      2 
      3 const c = @import("c.zig").c;
      4 const StringView = @import("common.zig").StringView;
      5 
      6 pub const LogLevel = enum(u32) {
      7     off = 0x00000000,
      8     @"error" = 0x00000001,
      9     warn = 0x00000002,
     10     info = 0x00000003,
     11     debug = 0x00000004,
     12     trace = 0x00000005,
     13 };
     14 
     15 pub const LogCallback = fn (LogLevel, StringView, ?*anyopaque) callconv(.C) void;
     16 
     17 pub fn setLogLevel(level: LogLevel) void {
     18     c.wgpuSetLogLevel(@intCast(@intFromEnum(level)));
     19 }
     20 
     21 pub fn setLogCallback(callback: *const LogCallback) void {
     22     c.wgpuSetLogCallback(@ptrCast(callback), null);
     23 }