Commit fe46ff2a authored by Lu Xu's avatar Lu Xu 👀

WIP

parent 435098cb
[
{
"time": "2022-11-09 18:05:57,189",
"log_level": "INFO",
"message": "msg",
"data": "{'cpu_temperature': 10}"
},
{
"time": "2022-11-09 18:06:28,114",
"log_level": "INFO",
"message": "msg",
"data": "{'cpu_temperature': 18}"
},
{
"time": "2022-11-09 18:06:35,729",
"log_level": "INFO",
"message": "msg",
"data":"{'cpu_temperature': 16}"
}
]
fetch('example.json.log')
.then(function (response) {
return response.json();
})
.then(function (log_list) {
appendData(log_list);
})
.catch(function (err) {
console.log('error: ' + err);
});
function appendData(log_list) {
var mainContainer = document.getElementById("myLog");
for (var i = 0; i < log_list.length; i++) {
var div = document.createElement("div");
console.log(JSON.parse(log_list[i].data))
div.innerHTML = log_list[i].time + " " + log_list[i].log_level + " " + log_list[i].message + " " + log_list[i].data;
mainContainer.appendChild(div);
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
<html>
<head>
<script src="rsvp.js"></script>
<script src="renderjs.js"></script>
<script src="example.json.log"></script>
<script src="promise_gadget.js"></script>
</head>
<body>
<body>
<div id="myLog"></div>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment