1 /+
2 +            Copyright 2022 – 2024 Aya Partridge
3 +          Copyright 2018 - 2022 Michael D. Parker
4 + Distributed under the Boost Software License, Version 1.0.
5 +     (See accompanying file LICENSE_1_0.txt or copy at
6 +           http://www.boost.org/LICENSE_1_0.txt)
7 +/
8 module sdl.log;
9 
10 import bindbc.sdl.config;
11 import bindbc.sdl.codegen;
12 
13 //NOTE: as-of SDL 2.24, there is no longer a max log message length
14 enum SDL_MAX_LOG_MESSAGE = 4096;
15 
16 alias SDL_LogCategory = uint;
17 enum: SDL_LogCategory{
18 	SDL_LOG_CATEGORY_APPLICATION,
19 	SDL_LOG_CATEGORY_ERROR,
20 	SDL_LOG_CATEGORY_ASSERT,
21 	SDL_LOG_CATEGORY_SYSTEM,
22 	SDL_LOG_CATEGORY_AUDIO,
23 	SDL_LOG_CATEGORY_VIDEO,
24 	SDL_LOG_CATEGORY_RENDER,
25 	SDL_LOG_CATEGORY_INPUT,
26 	SDL_LOG_CATEGORY_TEST,
27 	
28 	SDL_LOG_CATEGORY_RESERVED1,
29 	SDL_LOG_CATEGORY_RESERVED2,
30 	SDL_LOG_CATEGORY_RESERVED3,
31 	SDL_LOG_CATEGORY_RESERVED4,
32 	SDL_LOG_CATEGORY_RESERVED5,
33 	SDL_LOG_CATEGORY_RESERVED6,
34 	SDL_LOG_CATEGORY_RESERVED7,
35 	SDL_LOG_CATEGORY_RESERVED8,
36 	SDL_LOG_CATEGORY_RESERVED9,
37 	SDL_LOG_CATEGORY_RESERVED10,
38 	
39 	SDL_LOG_CATEGORY_CUSTOM,
40 }
41 
42 alias SDL_LogPriority = uint;
43 enum: SDL_LogPriority{
44 	SDL_LOG_PRIORITY_VERBOSE = 1,
45 	SDL_LOG_PRIORITY_DEBUG,
46 	SDL_LOG_PRIORITY_INFO,
47 	SDL_LOG_PRIORITY_WARN,
48 	SDL_LOG_PRIORITY_ERROR,
49 	SDL_LOG_PRIORITY_CRITICAL,
50 	SDL_NUM_LOG_PRIORITIES,
51 }
52 
53 alias SDL_LogOutputFunction = extern(C) void function(void* userData, int category, SDL_LogPriority priority, const(char)* message) nothrow;
54 
55 mixin(joinFnBinds((){
56 	FnBind[] ret = [
57 		{q{void}, q{SDL_LogSetAllPriority}, q{SDL_LogPriority priority}},
58 		{q{void}, q{SDL_LogSetPriority}, q{int category, SDL_LogPriority priority}},
59 		{q{SDL_LogPriority}, q{SDL_LogGetPriority}, q{int category}},
60 		{q{void}, q{SDL_LogResetPriorities}, q{}},
61 		{q{void}, q{SDL_Log}, q{const(char)* fmt, ...}},
62 		{q{void}, q{SDL_LogVerbose}, q{int category, const(char)* fmt, ...}},
63 		{q{void}, q{SDL_LogDebug}, q{int category, const(char)* fmt, ...}},
64 		{q{void}, q{SDL_LogInfo}, q{int category, const(char)* fmt, ...}},
65 		{q{void}, q{SDL_LogWarn}, q{int category, const(char)* fmt, ...}},
66 		{q{void}, q{SDL_LogError}, q{int category, const(char)* fmt, ...}},
67 		{q{void}, q{SDL_LogCritical}, q{int category, const(char)* fmt, ...}},
68 		{q{void}, q{SDL_LogMessage}, q{int category, SDL_LogPriority priority, const(char)* fmt, ...}},
69 		{q{void}, q{SDL_LogMessageV}, q{int category, SDL_LogPriority priority, const(char)* fmt, va_list ap}},
70 		{q{void}, q{SDL_LogGetOutputFunction}, q{SDL_LogOutputFunction callback, void** userData}},
71 		{q{void}, q{SDL_LogSetOutputFunction}, q{SDL_LogOutputFunction callback, void* userData}},
72 	];
73 	return ret;
74 }()));