Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Syntax highlight logged javascript objects via Rainbow
  • Loading branch information
gashcrumb committed Oct 24, 2013
1 parent 0e1f921 commit 969122e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions hawtio-web/src/main/webapp/app/health/js/health.ts
Expand Up @@ -94,6 +94,7 @@ module Health {
// update the last result callback to update the UI
onSuccessArray[onSuccessArray.length - 1] = (response) => {
callback(response, objects.last);
console.log("$scope.results: ", $scope.results);
$scope.widget.populateTable(defaultValues($scope.results));
Core.$apply($scope);
};
Expand Down
3 changes: 3 additions & 0 deletions hawtio-web/src/main/webapp/css/site-base.css
Expand Up @@ -60,6 +60,9 @@ a:focus {
font-size: 11px;
}

#log-panel-statements li pre span {
font-family: monospace;
}

#log-panel-statements li:hover {
background: #111111;
Expand Down
11 changes: 9 additions & 2 deletions hawtio-web/src/main/webapp/index.html
Expand Up @@ -15,6 +15,7 @@
<link rel='stylesheet' href='css/angular-ui.css' type='text/css'>
<link rel='stylesheet' href='css/ng-grid.css' type='text/css'>
<link rel='stylesheet' href='css/jquery.gridster.css' type='text/css'>
<link rel='stylesheet' href='css/twilight.css' type='text/css'>
<link rel='stylesheet' href='css/codemirror/themes/ambiance.css' type='text/css'>
<link rel='stylesheet' href='css/codemirror/themes/blackboard.css' type='text/css'>
<link rel='stylesheet' href='css/codemirror/themes/cobalt.css' type='text/css'>
Expand Down Expand Up @@ -219,6 +220,9 @@ <h2 title="Status Code: {{connectFailure.status}}">Cannot Connect: {{connectFail
<!--
Configure logging first thing...
-->
<script type="text/javascript" src="lib/rainbow.js"></script>
<script type="text/javascript" src="lib/language/javascript.js"></script>
<script type="text/javascript" src="lib/language/generic.js"></script>
<script type="text/javascript" src="lib/logger.min.js"></script>
<script type="text/javascript" src="lib/json2-min.js"></script>

Expand Down Expand Up @@ -298,7 +302,7 @@ <h2 title="Status Code: {{connectFailure.status}}">Cannot Connect: {{connectFail
for (var i = 0; i < messages.length; i++) {
var message = messages[i];
if (isArrayOrObject(message)) {
text = text + '<pre>' + JSON.stringify(message, null, 2) + '</pre>';
text = text + '<pre data-language="javascript">' + JSON.stringify(message, null, 2) + '</pre>';
} else {
text = text + message;
}
Expand All @@ -310,7 +314,10 @@ <h2 title="Status Code: {{connectFailure.status}}">Cannot Connect: {{connectFail

node.innerHTML = text;
node.className = context.level.name;
panel.appendChild(node);
Rainbow.color(node, function() {
panel.appendChild(node);
});
//panel.appendChild(node);
if (panel.childNodes.length > parseInt(window['LogBuffer'])) {
panel.firstChild.remove();
}
Expand Down

0 comments on commit 969122e

Please sign in to comment.