Files
fmt/src/main/resources/templates/logging.html
2025-07-18 09:32:46 +08:00

53 lines
2.3 KiB
HTML

<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="https://www.thymeleaf.org">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="apple-touch-fullscreen" content="yes"/>
<meta name="format-detection" content="email=no" />
<meta name="wap-font-scale" content="no" />
<meta name="viewport" content="user-scalable=no, width=device-width" />
<meta content="telephone=no" name="format-detection" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>在线日志</title>
</head>
<body>
<!-- 日志容器 -->
<div id="logContainer"></div>
<script th:src="@{/common/js/basic.js}" type="text/javascript" charset="utf-8"></script>
<script th:src="@{/common/js/LogMonitorAdaptive.js}" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" th:inline="javascript" charset="utf-8">
window.onload = () => {
const logger = new LogMonitorAdaptive('#logContainer', {
theme: 'dark',
maxLines: 5000,
fontSize: 14,
enableFilter: true,
enableSearch: true,
enableExport: true,
enableClear: true,
enablePause: true,
enableThemeToggle: true,
enableFullscreen: true,
enableFontSize: true,
enableWordWrap: true,
showTimestamp: true, // 是否显示时间戳
showLevel: true, // 是否显示日志级别标签
//暂停/继续 回调函数
onTogglePause: (isPaused) => {
const options = {
url: Fmt.ctx() + '/logging/close',
data: {closed: isPaused},
method: 'post'
};
Fmt.axios(options).then((result) => console.log(result)).catch((err) => console.error(err));
},
onCreated: () => {
console.log('日志容器已创建');
}
});
}
</script>
</body>
</html>