初步实现前端展示
parent
db531ecde1
commit
71c0de2aa9
|
@ -3,10 +3,11 @@ package com.genersoft.iot.vmp.conf.webLog;
|
||||||
import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
|
import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
|
||||||
import ch.qos.logback.classic.spi.ILoggingEvent;
|
import ch.qos.logback.classic.spi.ILoggingEvent;
|
||||||
import ch.qos.logback.core.AppenderBase;
|
import ch.qos.logback.core.AppenderBase;
|
||||||
import com.genersoft.iot.vmp.utils.DateUtil;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class WebSocketAppender extends AppenderBase<ILoggingEvent> {
|
public class WebSocketAppender extends AppenderBase<ILoggingEvent> {
|
||||||
|
@ -17,6 +18,7 @@ public class WebSocketAppender extends AppenderBase<ILoggingEvent> {
|
||||||
protected void append(ILoggingEvent loggingEvent) {
|
protected void append(ILoggingEvent loggingEvent) {
|
||||||
byte[] data = this.encoder.encode(loggingEvent);
|
byte[] data = this.encoder.encode(loggingEvent);
|
||||||
// Push to client.
|
// Push to client.
|
||||||
LogChannel.push(DateUtil.timestampMsTo_yyyy_MM_dd_HH_mm_ss(loggingEvent.getTimeStamp()) + " " + loggingEvent.getFormattedMessage());
|
// LogChannel.push(DateUtil.timestampMsTo_yyyy_MM_dd_HH_mm_ss(loggingEvent.getTimeStamp()) + " " + loggingEvent.getFormattedMessage());
|
||||||
|
LogChannel.push(new String(data, StandardCharsets.UTF_8));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<!-- WebSocket -->
|
<!-- WebSocket -->
|
||||||
<appender name="websocket" class="com.genersoft.iot.vmp.conf.webLog.WebSocketAppender">
|
<appender name="websocket" class="com.genersoft.iot.vmp.conf.webLog.WebSocketAppender">
|
||||||
<encoder>
|
<encoder>
|
||||||
<pattern>${FILE_LOG_PATTERN}</pattern>
|
<pattern>${log.pattern}</pattern>
|
||||||
<charset>UTF-8</charset>
|
<charset>UTF-8</charset>
|
||||||
</encoder>
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
|
@ -10,10 +10,14 @@
|
||||||
"build": "node build/build.js"
|
"build": "node build/build.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@babel/runtime": "^7.3.0",
|
||||||
|
"@femessage/log-viewer": "^1.5.0",
|
||||||
"@liveqing/liveplayer": "^2.7.10",
|
"@liveqing/liveplayer": "^2.7.10",
|
||||||
"@wchbrad/vue-easy-tree": "^1.0.12",
|
"@wchbrad/vue-easy-tree": "^1.0.12",
|
||||||
|
"ansi_up": "^6.0.2",
|
||||||
"axios": "^0.24.0",
|
"axios": "^0.24.0",
|
||||||
"core-js": "^2.6.5",
|
"core-js": "^2.6.5",
|
||||||
|
"defineProperty": "link:@babel/runtime/helpers/defineProperty",
|
||||||
"echarts": "^4.9.0",
|
"echarts": "^4.9.0",
|
||||||
"element-ui": "^2.15.14",
|
"element-ui": "^2.15.14",
|
||||||
"fingerprintjs2": "^2.1.2",
|
"fingerprintjs2": "^2.1.2",
|
||||||
|
@ -21,6 +25,7 @@
|
||||||
"ol": "^6.14.1",
|
"ol": "^6.14.1",
|
||||||
"postcss-pxtorem": "^5.1.1",
|
"postcss-pxtorem": "^5.1.1",
|
||||||
"screenfull": "5.1.0",
|
"screenfull": "5.1.0",
|
||||||
|
"slicedToArray": "link:@babel/runtime/helpers/slicedToArray",
|
||||||
"uuid": "^8.3.2",
|
"uuid": "^8.3.2",
|
||||||
"v-charts": "^1.19.0",
|
"v-charts": "^1.19.0",
|
||||||
"vue": "^2.6.11",
|
"vue": "^2.6.11",
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
<template>
|
<template>
|
||||||
<div id="log" style="width: 100%">
|
<div id="log" style="width: 100%;height: 100%">
|
||||||
<el-container v-loading="loading" >
|
<log-viewer :log="data" :loading="loading" :auto-scroll="false" :height="winHeight" />
|
||||||
<el-aside width="400px" >
|
|
||||||
</el-aside>
|
|
||||||
<el-main style="padding: 5px;">
|
|
||||||
</el-main>
|
|
||||||
</el-container>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// import uiHeader from '../layout/UiHeader.vue'
|
// import uiHeader from '../layout/UiHeader.vue'
|
||||||
|
import {AnsiUp} from 'ansi_up'
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'log',
|
name: 'log',
|
||||||
|
@ -19,6 +16,9 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loading: false,
|
loading: false,
|
||||||
|
winHeight: window.innerHeight - 120,
|
||||||
|
data: '',
|
||||||
|
ansiUp: new AnsiUp()
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ export default {
|
||||||
}
|
}
|
||||||
websocket.onmessage = e => {
|
websocket.onmessage = e => {
|
||||||
console.log(e.data);
|
console.log(e.data);
|
||||||
|
this.data += e.data + "\r\n"
|
||||||
}
|
}
|
||||||
websocket.onerror = e => {
|
websocket.onerror = e => {
|
||||||
console.log(`conn err`)
|
console.log(`conn err`)
|
||||||
|
|
|
@ -6,6 +6,7 @@ import router from './router/index.js';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import VueCookies from 'vue-cookies';
|
import VueCookies from 'vue-cookies';
|
||||||
import VCharts from 'v-charts';
|
import VCharts from 'v-charts';
|
||||||
|
import logViewer from '@femessage/log-viewer';
|
||||||
|
|
||||||
import VueClipboard from 'vue-clipboard2';
|
import VueClipboard from 'vue-clipboard2';
|
||||||
import Fingerprint2 from 'fingerprintjs2';
|
import Fingerprint2 from 'fingerprintjs2';
|
||||||
|
@ -40,6 +41,7 @@ Vue.use(VueClipboards);
|
||||||
Vue.prototype.$notify = Notification;
|
Vue.prototype.$notify = Notification;
|
||||||
Vue.use(Contextmenu);
|
Vue.use(Contextmenu);
|
||||||
Vue.use(VCharts);
|
Vue.use(VCharts);
|
||||||
|
Vue.use(logViewer);
|
||||||
|
|
||||||
axios.defaults.baseURL = (process.env.NODE_ENV === 'development') ? process.env.BASE_API : (window.baseUrl ? window.baseUrl : "");
|
axios.defaults.baseURL = (process.env.NODE_ENV === 'development') ? process.env.BASE_API : (window.baseUrl ? window.baseUrl : "");
|
||||||
axios.defaults.withCredentials = true;
|
axios.defaults.withCredentials = true;
|
||||||
|
|
Loading…
Reference in New Issue