reference Environment variables

OPENGREP_LOG_LEVEL

Also spelled
SEMGREP_LOG_LEVEL
Value
none, app, error, warning, info or debug
See also
--quiet, --verbose, --debug, OPENGREP_LOG_SRCS, OPENGREP_LOG_TAGS, OPENGREP_LOG_FILE

The level of the log messages that Opengrep writes to standard error, and to the file named by OPENGREP_LOG_FILE when it is set. The variable takes precedence over the level set by --quiet, --verbose or --debug. Invalid values are ignored.

Several variables set the level. The first one set to a valid value takes precedence, in this order: PYTEST_OPENGREP_LOG_LEVEL, OPENGREP_LOG_LEVEL, PYTEST_SEMGREP_LOG_LEVEL, SEMGREP_LOG_LEVEL. The PYTEST_ names are meant for test runners.

Examples

Informational logs

rule.yaml
rules:  - id: find-eval    pattern: eval(...)    message: found eval    languages: [python]    severity: WARNING
app.py
eval(code)
Command and result
$ OPENGREP_LOG_LEVEL=info opengrep scan --quiet --config rule.yaml app.py 2>&1 >/dev/null | grep INFO | head -3
[00.04][INFO]: Opengrep version: X.Y.Z
[00.04][INFO]: Getting the rules
[00.04][INFO]: loading local config from rule.yaml