Skip to content

Commit

Permalink
Merge 748d373 into 63953ee
Browse files Browse the repository at this point in the history
  • Loading branch information
Neurone authored Oct 11, 2023
2 parents 63953ee + 748d373 commit 53bdad4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packages/server/src/koaJsonRpc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ export default class KoaJsonRpc {
return;
}

this.logger.trace(`[Request ID: ${this.getRequestId()}] Request body ${JSON.stringify(body)}`);

ctx.state.methodName = body.method;
const methodName = body.method;

Expand Down Expand Up @@ -192,6 +194,7 @@ export default class KoaJsonRpc {
break;
}
}
this.logger.trace(`[Request ID: ${this.getRequestId()}] Response body ${JSON.stringify(ctx.body)}`);
};
}

Expand Down
8 changes: 7 additions & 1 deletion packages/server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { formatRequestIdMessage } from './formatters';

const mainLogger = pino({
name: 'hedera-json-rpc-relay',
level: process.env.LOG_LEVEL || 'trace',
level: process.env.LOG_LEVEL || 'info',
transport: {
target: 'pino-pretty',
options: {
Expand Down Expand Up @@ -82,6 +82,12 @@ app.getKoaApp().use(async (ctx, next) => {
ctx.state.status
} ${ms} ms`,
);
// log the response
logger.trace(
`${formatRequestIdMessage(ctx.state.reqId)} [${ctx.method}]: ${ctx.state.methodName} ${
ctx.state.status
} ${JSON.stringify(ctx.body)}`,
);
methodResponseHistogram.labels(ctx.state.methodName, `${ctx.status}`).observe(ms);
}
});
Expand Down
2 changes: 1 addition & 1 deletion packages/ws-server/src/webSocketServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import constants from '@hashgraph/json-rpc-relay/dist/lib/constants';

const mainLogger = pino({
name: 'hedera-json-rpc-relay',
level: process.env.LOG_LEVEL || 'trace',
level: process.env.LOG_LEVEL || 'info',
transport: {
target: 'pino-pretty',
options: {
Expand Down

0 comments on commit 53bdad4

Please sign in to comment.