Skip to content

Commit 0e6af48

Browse files
author
Mike Goffin
committed
Add CLI flag for disabling console log printing.
- Add CLI flag that will disable the console module from printing: Short: -q Log: --disable-console-logs - Update documentation with new CLI flags Closes #1912
1 parent 67cccf0 commit 0e6af48

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

cli/yara.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ static bool negate = false;
159159
static bool print_count_only = false;
160160
static bool fail_on_warnings = false;
161161
static bool rules_are_compiled = false;
162+
static bool disable_console_logs = false;
162163
static long total_count = 0;
163164
static long limit = 0;
164165
static long timeout = 1000000;
@@ -199,6 +200,12 @@ args_option_t options[] = {
199200
_T("define external variable"),
200201
_T("VAR=VALUE")),
201202

203+
OPT_BOOLEAN(
204+
'q',
205+
_T("disable-console-logs"),
206+
&disable_console_logs,
207+
_T("disable printing console log messages")),
208+
202209
OPT_BOOLEAN(
203210
0,
204211
_T("fail-on-warnings"),
@@ -1245,7 +1252,8 @@ static int callback(
12451252
return CALLBACK_CONTINUE;
12461253

12471254
case CALLBACK_MSG_CONSOLE_LOG:
1248-
_tprintf(_T("%" PF_S "\n"), (char*) message_data);
1255+
if (!disable_console_logs)
1256+
_tprintf(_T("%" PF_S "\n"), (char*) message_data);
12491257
return CALLBACK_CONTINUE;
12501258
}
12511259

docs/commandline.rst

+4
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ Available options are:
6161

6262
Define external variable. This option can be used multiple times.
6363

64+
.. option:: -q --disable-console-logs
65+
66+
Disable printing console log messages.
67+
6468
.. option:: --fail-on-warnings
6569

6670
Treat warnings as errors. Has no effect if used with --no-warnings.

0 commit comments

Comments
 (0)