@@ -521,6 +521,9 @@ struct Comparer {
|
||||
#define LOG_DEBUG(cond) \
|
||||
::deepstate::Stream(DeepState_LogDebug, (cond), __FILE__, __LINE__)
|
||||
|
||||
#define LOG_TRACE(cond) \
|
||||
::deepstate::Stream(DeepState_LogTrace, (cond), __FILE__, __LINE__)
|
||||
|
||||
#define LOG_INFO(cond) \
|
||||
::deepstate::Stream(DeepState_LogInfo, (cond), __FILE__, __LINE__)
|
||||
|
||||
|
||||
@@ -34,12 +34,13 @@ struct DeepState_VarArgs {
|
||||
|
||||
enum DeepState_LogLevel {
|
||||
DeepState_LogDebug = 0,
|
||||
DeepState_LogInfo = 1,
|
||||
DeepState_LogWarning = 2,
|
||||
DeepState_LogTrace = 1,
|
||||
DeepState_LogInfo = 2,
|
||||
DeepState_LogWarning = 3,
|
||||
DeepState_LogWarn = DeepState_LogWarning,
|
||||
DeepState_LogError = 3,
|
||||
DeepState_LogExternal = 4,
|
||||
DeepState_LogFatal = 5,
|
||||
DeepState_LogError = 4,
|
||||
DeepState_LogExternal = 5,
|
||||
DeepState_LogFatal = 6,
|
||||
DeepState_LogCritical = DeepState_LogFatal,
|
||||
};
|
||||
|
||||
|
||||
+8
-6
@@ -47,6 +47,8 @@ static const char *DeepState_LogLevelStr(enum DeepState_LogLevel level) {
|
||||
switch (level) {
|
||||
case DeepState_LogDebug:
|
||||
return "DEBUG";
|
||||
case DeepState_LogTrace:
|
||||
return "TRACE";
|
||||
case DeepState_LogInfo:
|
||||
return "INFO";
|
||||
case DeepState_LogWarning:
|
||||
@@ -136,7 +138,7 @@ void DeepState_LogFormat(enum DeepState_LogLevel level,
|
||||
/* Override libc! */
|
||||
DEEPSTATE_NOINLINE
|
||||
int puts(const char *str) {
|
||||
DeepState_Log(DeepState_LogInfo, str);
|
||||
DeepState_Log(DeepState_LogTrace, str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -144,7 +146,7 @@ DEEPSTATE_NOINLINE
|
||||
int printf(const char *format, ...) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
DeepState_LogVFormat(DeepState_LogInfo, format, args);
|
||||
DeepState_LogVFormat(DeepState_LogTrace, format, args);
|
||||
va_end(args);
|
||||
return 0;
|
||||
}
|
||||
@@ -153,20 +155,20 @@ DEEPSTATE_NOINLINE
|
||||
int __printf_chk(int flag, const char *format, ...) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
DeepState_LogVFormat(DeepState_LogInfo, format, args);
|
||||
DeepState_LogVFormat(DeepState_LogTrace, format, args);
|
||||
va_end(args);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEEPSTATE_NOINLINE
|
||||
int vprintf(const char *format, va_list args) {
|
||||
DeepState_LogVFormat(DeepState_LogInfo, format, args);
|
||||
DeepState_LogVFormat(DeepState_LogTrace, format, args);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEEPSTATE_NOINLINE
|
||||
int __vprintf_chk(int flag, const char *format, va_list args) {
|
||||
DeepState_LogVFormat(DeepState_LogInfo, format, args);
|
||||
DeepState_LogVFormat(DeepState_LogTrace, format, args);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -175,7 +177,7 @@ int vfprintf(FILE *file, const char *format, va_list args) {
|
||||
if (stderr == file) {
|
||||
DeepState_LogVFormat(DeepState_LogDebug, format, args);
|
||||
} else if (stdout == file) {
|
||||
DeepState_LogVFormat(DeepState_LogInfo, format, args);
|
||||
DeepState_LogVFormat(DeepState_LogTrace, format, args);
|
||||
} else {
|
||||
DeepState_LogVFormat(DeepState_LogExternal, format, args);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user