expand base layer logging mechanism with bucketing info; make one bucket for passive log collection, another for user-facing errors; always consume user errors at the top-level and display; use user-error mechanism to communicate bad 32-bit app launches from demon

This commit is contained in:
Ryan Fleury
2024-05-14 08:10:02 -07:00
parent 6c200a59cd
commit 3085482e34
7 changed files with 104 additions and 61 deletions
+22 -4
View File
@@ -7,12 +7,26 @@
////////////////////////////////
//~ rjf: Log Types
typedef enum LogMsgKind
{
LogMsgKind_Info,
LogMsgKind_UserError,
LogMsgKind_COUNT
}
LogMsgKind;
typedef struct LogScope LogScope;
struct LogScope
{
LogScope *next;
U64 pos;
String8List strings;
String8List strings[LogMsgKind_COUNT];
};
typedef struct LogScopeResult LogScopeResult;
struct LogScopeResult
{
String8 strings[LogMsgKind_COUNT];
};
typedef struct Log Log;
@@ -32,13 +46,17 @@ internal void log_select(Log *log);
////////////////////////////////
//~ rjf: Log Building
internal void log_msg(String8 string);
internal void log_msgf(char *fmt, ...);
internal void log_msg(LogMsgKind kind, String8 string);
internal void log_msgf(LogMsgKind kind, char *fmt, ...);
#define log_info(s) log_msg(LogMsgKind_Info, (s))
#define log_infof(fmt, ...) log_msgf(LogMsgKind_Info, (fmt), __VA_ARGS__)
#define log_user_error(s) log_msg(LogMsgKind_UserError, (s))
#define log_user_errorf(fmt, ...) log_msgf(LogMsgKind_UserError, (fmt), __VA_ARGS__)
////////////////////////////////
//~ rjf: Log Scopes
internal void log_scope_begin(void);
internal String8 log_scope_end(Arena *arena);
internal LogScopeResult log_scope_end(Arena *arena);
#endif // BASE_LOG_H