Skip to content

Commit

Permalink
Log console output even if json output is selected, and verify the ou…
Browse files Browse the repository at this point in the history
…tput format chosen.
  • Loading branch information
smicallef committed Aug 15, 2021
1 parent 689d5cd commit e8abcef
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sf.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def main():
log.setLevel(logging.INFO)
sfConfig['_debug'] = False

if args.q or args.o == "json":
if args.q:
log.setLevel(logging.NOTSET)
sfConfig['__logging'] = False

Expand Down Expand Up @@ -341,6 +341,9 @@ def start_scan(sfConfig, sfModules, args):
sfp__stor_stdout_opts['_requested'] = args.F.split(",")
sfp__stor_stdout_opts['_showonlyrequested'] = True
if args.o:
if args.o not in ["tab", "csv", "json"]:
log.error("Invalid output format selected. Must be 'tab', 'csv' or 'json'.")
sys.exit(-1)
sfp__stor_stdout_opts['_format'] = args.o
if args.t:
sfp__stor_stdout_opts['_requested'] = args.t.split(",")
Expand Down

0 comments on commit e8abcef

Please sign in to comment.