代码提交
This commit is contained in:
@@ -2,11 +2,18 @@ package cn.somkit.fmt.action;
|
||||
|
||||
import cn.somkit.fmt.entity.LoggerMessage;
|
||||
import cn.somkit.fmt.utils.LoggerQueue;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/logging")
|
||||
@@ -16,10 +23,4 @@ public class LoggingAction {
|
||||
public String index() throws Exception{
|
||||
return "logging";
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@PostMapping("/get")
|
||||
public LoggerMessage getLoggerMessage() {
|
||||
return LoggerQueue.getInstance().poll();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,17 +40,6 @@
|
||||
},
|
||||
onCreated: () => {
|
||||
console.log('日志容器已创建');
|
||||
let index = setInterval(() => {
|
||||
const options = {
|
||||
url: Fmt.ctx() + '/logging/get',
|
||||
data: {},
|
||||
method: 'post'
|
||||
};
|
||||
Fmt.axios(options).then((result) => {
|
||||
console.log(result);
|
||||
logger.log(result.message, result.level);
|
||||
}).catch((err) => clearInterval(index));
|
||||
}, 500);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user