Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding a logger to the WebServer

  • Loading branch information...
commit 8dde9d97bcb143d52109f588b8b702337ef68292 1 parent ecc58ed
@PaulKinlan PaulKinlan authored
Showing with 13 additions and 5 deletions.
  1. +7 −4 webserver/index.html
  2. +5 −0 webserver/index.js
  3. +1 −1  webserver/main.js
View
11 webserver/index.html
@@ -46,7 +46,12 @@
box-shadow: none;
}
-
+ #logger {
+ border: solid 1px #c6c6c6;
+ border-radius: 5px;
+ box-shadow: inset 0px 0px 5px #c6c6c6;
+ height: 100px;
+ }
</style>
</head>
<body>
@@ -59,8 +64,6 @@
<button id="stop" class="btn btn-warning btn-large" disabled>Stop</button>
</p>
</div>
-
-
-
+ <div id="logger"></div>
</body>
</html>
View
5 webserver/index.js
@@ -25,6 +25,10 @@ onload = function() {
return str;
};
+ var logToScreen = function(log) {
+ logger.textContent += log + "\n";
+ }
+
var writeErrorResponse = function(socketId, errorCode) {
var file = { size: 0 };
console.info("writeErrorResponse:: begin... ");
@@ -87,6 +91,7 @@ onload = function() {
writeErrorResponse(acceptInfo.socketId, 404); /* File does not exist */
return;
}
+ logToScreen("GET 200 " + uri);
write200Response(acceptInfo.socketId, file);
}
else {
View
2  webserver/main.js
@@ -7,6 +7,6 @@
chrome.app.runtime.onLaunched.addListener(function(intentData) {
chrome.app.window.create('index.html', {
width: 500,
- height: 400
+ height: 540
});
});
Please sign in to comment.
Something went wrong with that request. Please try again.