fix: [backend] Fixed correct usage of logging API

This commit is contained in:
Sami Mokaddem 2024-07-02 13:56:10 +02:00
parent 1f5bcb2e66
commit b8b6e8c44a
2 changed files with 6 additions and 6 deletions

View file

@ -29,7 +29,7 @@ def get(url, data={}, api_key=misp_apikey):
try:
response = requestSession.get(full_url, data=data, headers=headers, verify=not misp_skipssl)
except requests.exceptions.ConnectionError as e:
logger.info('Could not perform request on MISP.', e)
logger.info('Could not perform request on MISP. %s', e)
return None
return response.json() if response.headers['content-type'].startswith('application/json') else response.text
@ -45,7 +45,7 @@ def post(url, data={}, api_key=misp_apikey):
try:
response = requestSession.post(full_url, data=json.dumps(data), headers=headers, verify=not misp_skipssl)
except requests.exceptions.ConnectionError as e:
logger.info('Could not perform request on MISP.', e)
logger.info('Could not perform request on MISP. %s', e)
return None
return response.json() if response.headers['content-type'].startswith('application/json') else response.text

View file

@ -58,11 +58,11 @@ app = socketio.WSGIApp(sio, static_files={
@sio.event
def connect(sid, environ):
logger.debug("Client connected: " + sid)
logger.debug("Client connected: %s", sid)
@sio.event
def disconnect(sid):
logger.debug("Client disconnected: " + sid)
logger.debug("Client disconnected: %s", sid)
@sio.event
def get_exercises(sid):
@ -110,7 +110,7 @@ def toggle_verbose_mode(sid, payload):
@sio.on('*')
def any_event(event, sid, data={}):
logger.info('>> Unhandled event', event)
logger.info('>> Unhandled event %s', event)
def handleMessage(topic, s, message):
data = json.loads(message)
@ -185,7 +185,7 @@ def forward_zmq_to_socketio():
ZMQ_MESSAGE_COUNT += 1
handleMessage(topic, s, m)
except Exception as e:
logger.error('Error handling message', e)
logger.error('Error handling message %s', e)
if __name__ == "__main__":