diff --git a/src/include/deepstate/DeepState.h b/src/include/deepstate/DeepState.h index bc0661b..fd61563 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 ad4a61a..fdf40ad 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."); + /* Set to 1 by Manticore/Angr/etc. when we're running symbolically. */ int DeepState_UsingSymExec = 0; diff --git a/src/lib/Log.c b/src/lib/Log.c index 63d67e4..cf31c04 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);