149 lines
3.4 KiB
Zig
149 lines
3.4 KiB
Zig
const std = @import("std");
|
|
pub const c = @import("c.zig").c;
|
|
|
|
pub const LogCategory = enum(c_int) {
|
|
logCategoryApplication,
|
|
logCategoryError,
|
|
logCategoryAssert,
|
|
logCategorySystem,
|
|
logCategoryAudio,
|
|
logCategoryVideo,
|
|
logCategoryRender,
|
|
logCategoryInput,
|
|
logCategoryTest,
|
|
logCategoryGpu,
|
|
logCategoryReserved2,
|
|
logCategoryReserved3,
|
|
logCategoryReserved4,
|
|
logCategoryReserved5,
|
|
logCategoryReserved6,
|
|
logCategoryReserved7,
|
|
logCategoryReserved8,
|
|
logCategoryReserved9,
|
|
logCategoryReserved10,
|
|
logCategoryCustom,
|
|
};
|
|
|
|
pub const LogPriority = enum(c_int) {
|
|
logPriorityInvalid,
|
|
logPriorityTrace,
|
|
logPriorityVerbose,
|
|
logPriorityDebug,
|
|
logPriorityInfo,
|
|
logPriorityWarn,
|
|
logPriorityError,
|
|
logPriorityCritical,
|
|
logPriorityCount,
|
|
};
|
|
|
|
pub inline fn setLogPriorities(priority: LogPriority) void {
|
|
return c.SDL_SetLogPriorities(priority);
|
|
}
|
|
|
|
pub inline fn setLogPriority(category: c_int, priority: LogPriority) void {
|
|
return c.SDL_SetLogPriority(category, priority);
|
|
}
|
|
|
|
pub inline fn getLogPriority(category: c_int) LogPriority {
|
|
return c.SDL_GetLogPriority(category);
|
|
}
|
|
|
|
pub inline fn resetLogPriorities() void {
|
|
return c.SDL_ResetLogPriorities();
|
|
}
|
|
|
|
pub inline fn setLogPriorityPrefix(priority: LogPriority, prefix: [*c]const u8) bool {
|
|
return c.SDL_SetLogPriorityPrefix(priority, prefix);
|
|
}
|
|
|
|
pub inline fn log(fmt: [*c]const u8, ...) void {
|
|
return c.SDL_Log(
|
|
fmt,
|
|
);
|
|
}
|
|
|
|
pub inline fn logTrace(category: c_int, fmt: [*c]const u8, ...) void {
|
|
return c.SDL_LogTrace(
|
|
category,
|
|
fmt,
|
|
);
|
|
}
|
|
|
|
pub inline fn logVerbose(category: c_int, fmt: [*c]const u8, ...) void {
|
|
return c.SDL_LogVerbose(
|
|
category,
|
|
fmt,
|
|
);
|
|
}
|
|
|
|
pub inline fn logDebug(category: c_int, fmt: [*c]const u8, ...) void {
|
|
return c.SDL_LogDebug(
|
|
category,
|
|
fmt,
|
|
);
|
|
}
|
|
|
|
pub inline fn logInfo(category: c_int, fmt: [*c]const u8, ...) void {
|
|
return c.SDL_LogInfo(
|
|
category,
|
|
fmt,
|
|
);
|
|
}
|
|
|
|
pub inline fn logWarn(category: c_int, fmt: [*c]const u8, ...) void {
|
|
return c.SDL_LogWarn(
|
|
category,
|
|
fmt,
|
|
);
|
|
}
|
|
|
|
pub inline fn logError(category: c_int, fmt: [*c]const u8, ...) void {
|
|
return c.SDL_LogError(
|
|
category,
|
|
fmt,
|
|
);
|
|
}
|
|
|
|
pub inline fn logCritical(category: c_int, fmt: [*c]const u8, ...) void {
|
|
return c.SDL_LogCritical(
|
|
category,
|
|
fmt,
|
|
);
|
|
}
|
|
|
|
pub inline fn logMessage(
|
|
category: c_int,
|
|
priority: LogPriority,
|
|
fmt: [*c]const u8,
|
|
...,
|
|
) void {
|
|
return c.SDL_LogMessage(
|
|
category,
|
|
priority,
|
|
fmt,
|
|
);
|
|
}
|
|
|
|
pub inline fn logMessageV(
|
|
category: c_int,
|
|
priority: LogPriority,
|
|
fmt: [*c]const u8,
|
|
ap: std.builtin.VaList,
|
|
) void {
|
|
return c.SDL_LogMessageV(category, priority, fmt, ap);
|
|
}
|
|
|
|
pub const LogOutputFunction = *const fn (userdata: ?*anyopaque, category: c_int, priority: LogPriority, message: [*c]const u8) callconv(.C) void;
|
|
|
|
pub inline fn getDefaultLogOutputFunction() LogOutputFunction {
|
|
return c.SDL_GetDefaultLogOutputFunction();
|
|
}
|
|
|
|
pub inline fn getLogOutputFunction(callback: ?*LogOutputFunction, userdata: [*c]?*anyopaque) void {
|
|
return c.SDL_GetLogOutputFunction(callback, userdata);
|
|
}
|
|
|
|
pub inline fn setLogOutputFunction(callback: LogOutputFunction, userdata: ?*anyopaque) void {
|
|
return c.SDL_SetLogOutputFunction(callback, userdata);
|
|
}
|