Skip to content

Commit

Permalink
Disable excessive logging for subcommands
Browse files Browse the repository at this point in the history
  • Loading branch information
inashivb committed Oct 5, 2019
1 parent 961fa27 commit 794c1e8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions suricata/update/config.py
Expand Up @@ -15,6 +15,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.

import sys
import os.path
import logging

Expand Down Expand Up @@ -155,6 +156,9 @@ def init(args):
_args = args
_config.update(DEFAULT_CONFIG)

if args.subcommand != "update":
logging.disable(sys.maxsize)

if args.config:
logger.info("Loading %s", args.config)
with open(args.config, "rb") as fileobj:
Expand Down Expand Up @@ -235,3 +239,4 @@ def init(args):
logger.info("Using %s for Suricata provided rules.", path)
_config[DIST_RULE_DIRECTORY_KEY] = path
break
logging.disable(logging.NOTSET)
6 changes: 5 additions & 1 deletion suricata/update/main.py
Expand Up @@ -1251,6 +1251,8 @@ def _main():

suricata_path = config.get("suricata")

if args.subcommand != "update":
logging.disable(sys.maxsize)
# Now parse the Suricata version. If provided on the command line,
# use that, otherwise attempt to get it from Suricata.
if args.suricata_version:
Expand All @@ -1272,10 +1274,12 @@ def _main():
return 1
else:
logger.info(
"Using default Suricata version of %s", DEFAULT_SURICATA_VERSION)
"Using default Suricata version of %s", DEFAULT_SURICATA_VERSION)
suricata_version = suricata.update.engine.parse_version(
DEFAULT_SURICATA_VERSION)

logging.disable(logging.NOTSET)

# Provide the Suricata version to the net module to add to the
# User-Agent.
suricata.update.net.set_user_agent_suricata_version(suricata_version.full)
Expand Down

0 comments on commit 794c1e8

Please sign in to comment.