Fixed leaky imports, modified log stuff
This commit is contained in:
6
base.cpp
6
base.cpp
@@ -561,7 +561,7 @@ arena_init(Arena *a, String debug_name){
|
||||
a->debug_string = debug_name;
|
||||
}
|
||||
|
||||
enum Log_Kind{Log_Kind_Normal, Log_Kind_Error, Log_Kind_Trace};
|
||||
enum Log_Kind{Log_Kind_Normal_No_NewLine, Log_Kind_Normal, Log_Kind_Error, Log_Kind_Trace};
|
||||
typedef void Log_Proc(Log_Kind kind, String string, char *file, int line);
|
||||
//-----------------------------------------------------------------------------
|
||||
// Thread Context
|
||||
@@ -753,6 +753,7 @@ array_make(Arena *a, S64 size = 16){
|
||||
// Logging
|
||||
//-----------------------------------------------------------------------------
|
||||
#define log_info(...) handle_log_message(Log_Kind_Normal, __LINE__, __FILE__,##__VA_ARGS__)
|
||||
#define log_info_no_nl(...) handle_log_message(Log_Kind_Normal_No_NewLine, __LINE__, __FILE__,##__VA_ARGS__)
|
||||
#define log_trace(...) handle_log_message(Log_Kind_Trace, __LINE__, __FILE__,##__VA_ARGS__)
|
||||
#define log_error(...) handle_log_message(Log_Kind_Error, __LINE__, __FILE__,##__VA_ARGS__)
|
||||
function void
|
||||
@@ -764,6 +765,9 @@ handle_log_message(Log_Kind kind, int line, const char *file, const char *str, .
|
||||
if(thread_ctx.log_proc) thread_ctx.log_proc(kind, message, (char *)file, line);
|
||||
else{
|
||||
printf("%s", message.str);
|
||||
if(kind != Log_Kind_Normal_No_NewLine){
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user