refactor(striker-ui-api): centralize all JSON.stringify in logs

main
Tsu-ba-me 9 months ago
parent ba9c65addc
commit d79599083f
  1. 9
      striker-ui-api/src/lib/request_handlers/fence/getFence.ts
  2. 4
      striker-ui-api/src/lib/request_handlers/host/getHostConnection.ts
  3. 10
      striker-ui-api/src/lib/request_handlers/manifest/getManifestDetail.ts

@ -4,7 +4,7 @@ import { DELETED } from '../../consts';
import buildGetRequestHandler from '../buildGetRequestHandler';
import { buildQueryResultReducer } from '../../buildQueryResultModifier';
import { pout } from '../../shell';
import { poutvar } from '../../shell';
export const getFence: RequestHandler = buildGetRequestHandler(
(request, buildQueryOptions) => {
@ -48,12 +48,9 @@ export const getFence: RequestHandler = buildGetRequestHandler(
{},
);
pout(
`${fenceAgent}: ${fenceName} (${fenceUUID})\n${JSON.stringify(
poutvar(
fenceParameters,
null,
2,
)}`,
`${fenceAgent}: ${fenceName} (${fenceUUID}) `,
);
previous[fenceUUID] = {

@ -3,7 +3,7 @@ import { buildUnknownIDCondition } from '../../buildCondition';
import buildGetRequestHandler from '../buildGetRequestHandler';
import { toLocal } from '../../convertHostUUID';
import { match } from '../../match';
import { pout } from '../../shell';
import { pout, poutvar } from '../../shell';
const buildHostConnections = (
fromHostUUID: string,
@ -85,7 +85,7 @@ export const getHostConnection = buildGetRequestHandler(
return previous;
}, {});
pout(`connections=[${JSON.stringify(connections, null, 2)}]`);
poutvar(connections, 'connections=');
if (buildQueryOptions) {
buildQueryOptions.afterQueryReturn = (queryStdout) => {

@ -2,7 +2,7 @@ import { RequestHandler } from 'express';
import { getManifestData } from '../../accessModule';
import { getEntityParts } from '../../disassembleEntityId';
import { perr, pout } from '../../shell';
import { perr, pout, poutvar } from '../../shell';
const handleSortEntries = <T extends [string, unknown]>(
[aId]: T,
@ -84,13 +84,7 @@ export const getManifestDetail: RequestHandler = async (request, response) => {
return;
}
pout(
`Raw install manifest list:\n${JSON.stringify(
rawManifestListData,
null,
2,
)}`,
);
poutvar(rawManifestListData, 'Raw install manifest list: ');
if (!rawManifestListData) {
response.status(404).send();

Loading…
Cancel
Save