diff --git a/ogl_editor/src/rlog.c b/ogl_editor/src/rlog.c new file mode 100644 index 0000000..4e1d8e0 --- /dev/null +++ b/ogl_editor/src/rlog.c @@ -0,0 +1,42 @@ +#include "rlog.h" +#include +#include + +static int s_log_level = 0; +static int s_old_level = 0; + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void rlog(int logLevel, const char* format, ...) +{ + va_list ap; + + if (logLevel < s_log_level) + return; + + va_start(ap, format); + vprintf(format, ap); + va_end(ap); +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void rlog_set_level(int logLevel) +{ + s_log_level = logLevel; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void rlog_level_push() +{ + s_old_level = s_log_level; +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void rlog_level_pop() +{ + s_log_level = s_old_level; +} + diff --git a/ogl_editor/src/rlog.h b/ogl_editor/src/rlog.h new file mode 100644 index 0000000..2aa7874 --- /dev/null +++ b/ogl_editor/src/rlog.h @@ -0,0 +1,14 @@ +#pragma once + +enum +{ + R_DEBUG, + R_INFO, + R_ERROR, +}; + +void rlog(int logLevel, const char* format, ...); +void rlog_set_level(int logLevel); +void rlog_level_push(); +void rlog_level_pop(); +