diff --git a/src/include/deepstate/DeepState.h b/src/include/deepstate/DeepState.h index 1020910..09f2414 100644 --- a/src/include/deepstate/DeepState.h +++ b/src/include/deepstate/DeepState.h @@ -64,6 +64,8 @@ DECLARE_bool(take_over); DECLARE_bool(abort_on_fail); DECLARE_bool(verbose_reads); +DECLARE_int(log_level); + enum { DeepState_InputSize = 8192 }; diff --git a/src/lib/DeepState.c b/src/lib/DeepState.c index 91bbfc4..bb54b95 100644 --- a/src/lib/DeepState.c +++ b/src/lib/DeepState.c @@ -38,6 +38,8 @@ DEFINE_bool(take_over, false, "Replay test cases in take-over mode."); DEFINE_bool(abort_on_fail, false, "Abort on file replay failure (useful in file fuzzing)."); DEFINE_bool(verbose_reads, false, "Report on bytes being read during execution of test."); +DEFINE_int(log_level, 0, "Minimum level of logging to output.") + /* Pointer to the last registers DeepState_TestInfo data structure */ struct DeepState_TestInfo *DeepState_LastTestInfo = NULL; diff --git a/src/lib/Log.c b/src/lib/Log.c index e09eab3..4f4d642 100644 --- a/src/lib/Log.c +++ b/src/lib/Log.c @@ -73,7 +73,8 @@ char DeepState_LogBuf[DeepState_LogBufSize + 1] = {}; /* Log a C string. */ DEEPSTATE_NOINLINE void DeepState_Log(enum DeepState_LogLevel level, const char *str) { - if (DeepState_UsingLibFuzzer && (level < DeepState_LogExternal)) { + if ((DeepState_UsingLibFuzzer && (level < DeepState_LogExternal)) || + (level < FLAGS_log_level)) { return; } memset(DeepState_LogBuf, 0, DeepState_LogBufSize);