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

main
Tsu-ba-me 9 months ago
parent ba9c65addc
commit d79599083f
  1. 11
      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 buildGetRequestHandler from '../buildGetRequestHandler';
import { buildQueryResultReducer } from '../../buildQueryResultModifier'; import { buildQueryResultReducer } from '../../buildQueryResultModifier';
import { pout } from '../../shell'; import { poutvar } from '../../shell';
export const getFence: RequestHandler = buildGetRequestHandler( export const getFence: RequestHandler = buildGetRequestHandler(
(request, buildQueryOptions) => { (request, buildQueryOptions) => {
@ -48,12 +48,9 @@ export const getFence: RequestHandler = buildGetRequestHandler(
{}, {},
); );
pout( poutvar(
`${fenceAgent}: ${fenceName} (${fenceUUID})\n${JSON.stringify( fenceParameters,
fenceParameters, `${fenceAgent}: ${fenceName} (${fenceUUID}) `,
null,
2,
)}`,
); );
previous[fenceUUID] = { previous[fenceUUID] = {

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

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

Loading…
Cancel
Save