Further unify logging.
This commit is contained in:
parent
c226486d05
commit
958821b9ae
@ -7,14 +7,16 @@ import { useQuery } from '@apollo/react-hooks';
|
||||
|
||||
import { ConsoleContext, useQueryStatusReducer } from '../hooks';
|
||||
|
||||
import LOGS from '../gql/logs.graphql';
|
||||
|
||||
import Log from './Log';
|
||||
|
||||
const MAX_LINES = 1000;
|
||||
const logBuffer = [];
|
||||
|
||||
const LogPoller = ({ service, query }) => {
|
||||
const LogPoller = ({ service }) => {
|
||||
const { config } = useContext(ConsoleContext);
|
||||
const data = useQueryStatusReducer(useQuery(query, {
|
||||
const data = useQueryStatusReducer(useQuery(LOGS, {
|
||||
pollInterval: config.api.intervalLog,
|
||||
variables: { service, incremental: logBuffer.length !== 0 }
|
||||
}));
|
||||
@ -23,7 +25,7 @@ const LogPoller = ({ service, query }) => {
|
||||
return null;
|
||||
}
|
||||
|
||||
const { incremental, lines } = JSON.parse(data.wns_log.json);
|
||||
const { incremental, lines } = JSON.parse(data.logs.json);
|
||||
|
||||
if (!incremental && lines.length) {
|
||||
logBuffer.length = 0;
|
||||
|
@ -9,8 +9,6 @@ import Tab from '@material-ui/core/Tab';
|
||||
import Tabs from '@material-ui/core/Tabs';
|
||||
import TabContext from '@material-ui/lab/TabContext';
|
||||
|
||||
import SIGNAL_LOG from '../../../gql/logs.graphql';
|
||||
|
||||
import Panel from '../../../components/Panel';
|
||||
import Toolbar from '../../../components/Toolbar';
|
||||
|
||||
@ -64,7 +62,7 @@ const Signal = () => {
|
||||
|
||||
{tab === TAB_LOG && (
|
||||
<div className={classes.panel}>
|
||||
<LogPoller query={SIGNAL_LOG} />
|
||||
<LogPoller service='signal' />
|
||||
</div>
|
||||
)}
|
||||
</TabContext>
|
||||
|
@ -9,8 +9,6 @@ import Tab from '@material-ui/core/Tab';
|
||||
import Tabs from '@material-ui/core/Tabs';
|
||||
import TabContext from '@material-ui/lab/TabContext';
|
||||
|
||||
import WNS_LOG from '../../../gql/wns_log.graphql';
|
||||
|
||||
import LogPoller from "../../../components/LogPoller";
|
||||
import Panel from '../../../components/Panel';
|
||||
import Toolbar from '../../../components/Toolbar';
|
||||
@ -78,7 +76,7 @@ const WNS = () => {
|
||||
|
||||
{tab === TAB_LOG && (
|
||||
<div className={classes.panel}>
|
||||
<LogPoller query={WNS_LOG} />
|
||||
<LogPoller service='wns-lite' />
|
||||
</div>
|
||||
)}
|
||||
</TabContext>
|
||||
|
Loading…
Reference in New Issue
Block a user