forked from cerc-io/laconic-console
Unify log api.
This commit is contained in:
@@ -13,16 +13,12 @@ type JSONResult {
|
||||
#
|
||||
|
||||
type Query {
|
||||
app_log(incremental: Boolean): JSONResult!
|
||||
logs(service: String!, incremental: Boolean): JSONResult!
|
||||
app_status: JSONResult!
|
||||
ipfs_log(incremental: Boolean): JSONResult!
|
||||
ipfs_status: JSONResult!
|
||||
ipfs_swarm_log(incremental: Boolean): JSONResult!
|
||||
ipfs_swarm_status: JSONResult!
|
||||
signal_log(incremental: Boolean): JSONResult!
|
||||
signal_status: JSONResult!
|
||||
system_status: JSONResult!
|
||||
wns_log(incremental: Boolean): JSONResult!
|
||||
wns_status: JSONResult!
|
||||
}
|
||||
|
||||
|
||||
@@ -53,40 +53,12 @@ const getLogs = async (name, incremental = false, lines = 100) => {
|
||||
|
||||
export const logResolvers = {
|
||||
Query: {
|
||||
wns_log: async (_, { incremental }) => {
|
||||
const lines = await getLogs('wns-lite', incremental);
|
||||
logs: async (_, { service, incremental }) => {
|
||||
const lines = await getLogs(service, incremental);
|
||||
return {
|
||||
timestamp: new Date().toUTCString(),
|
||||
json: JSON.stringify({ incremental, lines })
|
||||
};
|
||||
},
|
||||
signal_log: async (_, { incremental }) => {
|
||||
const lines = await getLogs('signal', incremental);
|
||||
return {
|
||||
timestamp: new Date().toUTCString(),
|
||||
json: JSON.stringify({ incremental, lines })
|
||||
};
|
||||
},
|
||||
ipfs_log: async (_, { incremental }) => {
|
||||
const lines = await getLogs('ipfs', incremental);
|
||||
return {
|
||||
timestamp: new Date().toUTCString(),
|
||||
json: JSON.stringify({ incremental, lines })
|
||||
};
|
||||
},
|
||||
ipfs_swarm_log: async (_, { incremental }) => {
|
||||
const lines = await getLogs('ipfs-swarm-connect', incremental);
|
||||
return {
|
||||
timestamp: new Date().toUTCString(),
|
||||
json: JSON.stringify({ incremental, lines })
|
||||
};
|
||||
},
|
||||
app_log: async (_, { incremental }) => {
|
||||
const lines = await getLogs('app', incremental);
|
||||
return {
|
||||
timestamp: new Date().toUTCString(),
|
||||
json: JSON.stringify({ incremental, lines })
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user