Skip to content

Commit

Permalink
new_update
Browse files Browse the repository at this point in the history
  • Loading branch information
Utkarsh Agrawal authored and Utkarsh Agrawal committed Apr 20, 2022
1 parent ea7c864 commit 4457def
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions scscanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
rootparser.add_argument('--file', help='Please provide file path to Scan file')
parser.add_argument('--verbose', help='For verbose running')
parser.add_argument('--maxlines', help='Please provide maxium line numbers', default=3)
parser.add_argument('--outputfile', help='Provide the filename', required=True)
parser.add_argument('-o', '--outfile', help='Provide the filename', required=True)
parser.add_argument('--json', help='For Json OutPut')
parser.add_argument('--jira', help='Send OutPut to your Jira instance', action='store_true')
parser.add_argument('--slack', help='Send OutPut to your Slack WorkSpace Channel', action='store_true')
Expand All @@ -29,7 +29,7 @@
file = argss.file
lines = argss.maxlines
verbose = argss.verbose
outputfile = argss.outputfile
outputfile = argss.outfile
jsonfile = argss.json
check = argss.check
jira = argss.jira
Expand Down
3 changes: 2 additions & 1 deletion src/file_sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def slack_token_retriever(send_to_app):
for lists in configdata['slack']:
if lists['bot_token'] == "" and lists['channel_name'] == "":
logger.error("Please provide the valid Bot_Token and Channel Name")
sys.exit()
else:
return (lists['bot_token'], lists['channel_name'])

Expand All @@ -61,6 +62,6 @@ def slack_issue_creator(filename):
}
response = requests.post( url=url, data=data, headers={"Content-Type": "application/x-www-form-urlencoded"})
if response.status_code == 200:
print('\n\n', logger.info("File Successfully Sent to Slack"))
logger.info("File Successfully Sent to Slack")


6 changes: 3 additions & 3 deletions utils/logs_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def create_logger(logger_name, remote_logging=False):
logger = logging.getLogger(logger_name)
if not logger.handlers:
logger.setLevel(logging.DEBUG)
log_template = "%(asctime)s %(module)s %(levelname)s: %(message)s"
log_template = "%(module)s %(levelname)s: %(message)s"
formatter = logging.Formatter(log_template)
log_file_size_in_mb = 10
count_of_backups = 10 # example.log example.log.1 example.log.2
Expand All @@ -47,15 +47,15 @@ def create_logger(logger_name, remote_logging=False):
logger.addHandler(file_handler)

# Stdout handler
log_template = "%(asctime)s %(module)s %(levelname)s: %(message)s"
log_template = "%(module)s %(levelname)s: %(message)s"
formatter = logging.Formatter(log_template)
stdout_handler = logging.StreamHandler(sys.stdout)
stdout_handler.setFormatter(formatter)
logger.addHandler(stdout_handler)

if remote_logging:
# HTTP handler
log_template = "%(asctime)s %(module)s %(levelname)s: %(message)s"
log_template = "%(module)s %(levelname)s: %(message)s"
formatter = logging.Formatter(log_template)
http_handler = logging.handlers.HTTPHandler(host=cfg.remote_logging_host,
url=cfg.remote_logging_endpoint,
Expand Down

0 comments on commit 4457def

Please sign in to comment.