aboutsummaryrefslogtreecommitdiff
path: root/vendor/sdl2/sdl_log.odin
blob: b7668ee1de4d63ebb4748462fda4a26d6f5826ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package sdl2

import "core:c"

when ODIN_OS == .Windows {
	@(ignore_duplicates)
	foreign import lib "SDL2.lib"
} else {
	@(ignore_duplicates)
	foreign import lib "system:SDL2"
}

MAX_LOG_MESSAGE :: 4096

LogCategory :: enum c.int {
	APPLICATION,
	ERROR,
	ASSERT,
	SYSTEM,
	AUDIO,
	VIDEO,
	RENDER,
	INPUT,
	TEST,

	/* Reserved for future SDL library use */
	RESERVED1,
	RESERVED2,
	RESERVED3,
	RESERVED4,
	RESERVED5,
	RESERVED6,
	RESERVED7,
	RESERVED8,
	RESERVED9,
	RESERVED10,

	/* Beyond this point is reserved for application use, e.g.
	enum {
		MYAPP_CATEGORY_AWESOME1 = SDL_LOG_CATEGORY_CUSTOM,
		MYAPP_CATEGORY_AWESOME2,
		MYAPP_CATEGORY_AWESOME3,
		...
	};
	*/
	CUSTOM,
}

LogPriority :: enum c.int {
	DEFAULT = 0, // CUSTOM ONE
	VERBOSE = 1,
	DEBUG,
	INFO,
	WARN,
	ERROR,
	CRITICAL,
	NUM,
}

LogOutputFunction :: proc "c" (userdata: rawptr, category: LogCategory, priority: LogPriority, message: cstring)


@(default_calling_convention="c", link_prefix="SDL_")
foreign lib {
	LogSetAllPriority    :: proc(priority: LogPriority) ---
	LogSetPriority       :: proc(category: c.int, priority: LogPriority) ---
	LogGetPriority       :: proc(category: c.int) -> LogPriority ---
	LogResetPriorities   :: proc() ---
	Log                  :: proc(fmt: cstring, #c_vararg args: ..any) ---
	LogVerbose           :: proc(category: c.int, fmt: cstring, #c_vararg args: ..any) ---
	LogDebug             :: proc(category: c.int, fmt: cstring, #c_vararg args: ..any) ---
	LogInfo              :: proc(category: c.int, fmt: cstring, #c_vararg args: ..any) ---
	LogWarn              :: proc(category: c.int, fmt: cstring, #c_vararg args: ..any) ---
	LogError             :: proc(category: c.int, fmt: cstring, #c_vararg args: ..any) ---
	LogCritical          :: proc(category: c.int, fmt: cstring, #c_vararg args: ..any) ---
	LogMessage           :: proc(category: c.int, priority: LogPriority, fmt: cstring, #c_vararg args: ..any) ---
	// LogMessageV          :: proc(category: c.int, priority: LogPriority, fmt: cstring, ap: va_list) ---
	LogGetOutputFunction :: proc(callback: ^LogOutputFunction, userdata: ^rawptr) ---
	LogSetOutputFunction :: proc(callback: LogOutputFunction, userdata: rawptr) ---
}