You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
915 B
34 lines
915 B
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>tail log</title>
|
|
<script src="//cdn.bootcss.com/jquery/2.1.4/jquery.js"></script>
|
|
<style>
|
|
html,body
|
|
{
|
|
height:100%;
|
|
width:100%;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="log-container" style="height: 100%; overflow-y: scroll; background: #333; color: #aaa; padding: 10px;">
|
|
<div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
<script>
|
|
$(document).ready(function() {
|
|
// 指定websocket路径
|
|
var websocket = new WebSocket('ws://localhost:8080/w/ws.do');
|
|
websocket.onmessage = function(event) {
|
|
// 接收服务端的实时日志并添加到HTML页面中
|
|
$("#log-container div").append(event.data + "<p> </p>");
|
|
// 滚动条滚动到最低部
|
|
$("#log-container").scrollTop($("#log-container div").height() - $("#log-container").height());
|
|
};
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|