Improve error logging in the visualisation code
Change-Id: I607e732121cfa357cef3dea167e0adae7d6ac61c
diff --git a/visualisation/visualisation.py b/visualisation/visualisation.py
index 3f0c75c..5df9163 100644
--- a/visualisation/visualisation.py
+++ b/visualisation/visualisation.py
@@ -244,9 +244,10 @@
# We've been asked for a VLAN that doesn't exist
if vlan is None:
self.send_response(404)
- self.wfile.write('Content-type: text/html\r\n')
+ self.wfile.write('Content-type: text/plain\r\n')
self.end_headers()
- self.wfile.write('404 Not Found')
+ self.wfile.write('404 Not Found\r\n')
+ logging.error('VLAN graphic not found - asked for %s', self.parsed_path.path)
return
gim = Graphics()
@@ -259,9 +260,11 @@
# If we can't get the font we need, fail
except NameError:
self.send_response(500)
- self.wfile.write('Content-type: text/html\r\n')
+ self.wfile.write('Content-type: text/plain\r\n')
self.end_headers()
- self.wfile.write('500 Internal Server Error')
+ self.wfile.write('500 Internal Server Error\r\n')
+ logging.error('Unable to generate graphic, no fonts found - asked for %s',
+ self.parsed_path.path)
return
switch = {}
@@ -351,9 +354,10 @@
# Fall-through for any files we don't recognise
self.send_response(404)
- self.wfile.write('Content-type: text/html\r\n')
+ self.wfile.write('Content-type: text/plain\r\n')
self.end_headers()
self.wfile.write('404 Not Found')
+ logging.error('File not supported - asked for %s', self.parsed_path.path)
return
# Override the BaseHTTPRequestHandler log_message() method so we