Skip to content

Commit

Permalink
refactor: added id in the logs
Browse files Browse the repository at this point in the history
  • Loading branch information
albertolive committed Oct 11, 2024
1 parent c27a366 commit 4c0462d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/custodyController/src/custody.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,10 @@ export class CustodyController {
}

sanitizeAndLogApiCall(apiLogEntry: IApiCallLogEntry): void {
const { method, endpoint, success, timestamp, errorMessage, responseData } = apiLogEntry;
const { id, method, endpoint, success, timestamp, errorMessage, responseData } = apiLogEntry;

const sanitizedEntry: IApiCallLogEntry = {
id,
method,
endpoint,
success,
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk/src/custodianApi/eca3/util/json-rpc-call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default function (jsonRpcEndpoint: string, emit: (eventName: string, even
responseJson = await response.json();

emit(API_REQUEST_LOG_EVENT, {
id: requestId,
method,
endpoint: jsonRpcEndpoint,
success: !responseJson.error,
Expand All @@ -55,6 +56,7 @@ export default function (jsonRpcEndpoint: string, emit: (eventName: string, even
console.log("JSON-RPC <", method, requestId, e, jsonRpcEndpoint);

emit(API_REQUEST_LOG_EVENT, {
id: requestId,
method,
endpoint: jsonRpcEndpoint,
success: false,
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk/src/custodianApi/json-rpc/util/json-rpc-call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default function (jsonRpcEndpoint: string, emit: (eventName: string, even
responseJson = await response.json();

emit(API_REQUEST_LOG_EVENT, {
id: requestId,
method,
endpoint: jsonRpcEndpoint,
success: !responseJson.error,
Expand All @@ -55,6 +56,7 @@ export default function (jsonRpcEndpoint: string, emit: (eventName: string, even
console.log("JSON-RPC <", method, requestId, e, jsonRpcEndpoint);

emit(API_REQUEST_LOG_EVENT, {
id: requestId,
method,
endpoint: jsonRpcEndpoint,
success: false,
Expand Down
1 change: 1 addition & 0 deletions packages/types/src/IApiCallLogEntry.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export interface IApiCallLogEntry {
id?: number;
method: string;
endpoint: string;
success: boolean;
Expand Down

0 comments on commit 4c0462d

Please sign in to comment.