summaryrefslogtreecommitdiffhomepage
path: root/src/utils.c
diff options
context:
space:
mode:
authorMarco Lizza <[email protected]>2019-01-20 22:24:41 +0100
committerMarco Lizza <[email protected]>2019-01-20 22:24:41 +0100
commitf1d13aa469230960130038871a9ce785bbe55c71 (patch)
tree1d87b091ed9b01d9882edb13e3b9a53eaa92b6c4 /src/utils.c
parent932e9dbd090e48d96be8636beaaebcf11c2f9117 (diff)
downloadraylib-f1d13aa469230960130038871a9ce785bbe55c71.tar.gz
raylib-f1d13aa469230960130038871a9ce785bbe55c71.zip
Adding function to control the "exit-on-error" behaviour.
Diffstat (limited to 'src/utils.c')
-rw-r--r--src/utils.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/utils.c b/src/utils.c
index e9f46187..ab327272 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -54,6 +54,7 @@
// Log types messages
static TraceLogType logTypeLevel = LOG_INFO;
+static TraceLogType logTypeExit = LOG_ERROR;
static TraceLogCallback logCallback = NULL;
#if defined(PLATFORM_ANDROID)
@@ -85,6 +86,12 @@ void SetTraceLogLevel(TraceLogType logType)
logTypeLevel = logType;
}
+// Set the exit threshold (minimum) log level.
+void SetTraceLogExit(TraceLogType logType)
+{
+ logTypeExit = logType;
+}
+
// Set a trace log callback to enable custom logging bypassing raylib's one
void SetTraceLogCallback(TraceLogCallback callback)
{
@@ -141,7 +148,7 @@ void TraceLog(TraceLogType logType, const char *text, ...)
va_end(args);
- if (msgType == LOG_ERROR) exit(1); // If LOG_ERROR message, exit program
+ if (logType >= logTypeExit) exit(1); // If exit message, exit program
#endif // SUPPORT_TRACELOG
}