Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend logging #3295

Open
wants to merge 3 commits into
base: v8/develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/commands/common/validate-asset-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ class ValidateAssetCommand extends Command {
storeType = LOCAL_STORE_TYPES.TRIPLE,
} = command.data;

this.logger.debug(
`Validating Asset Command with operation id: ${operationId}, blockchain: ${blockchain}, contract: ${contract}, tokenId: ${tokenId}, store type: ${storeType}`,
);

await this.operationIdService.updateOperationIdStatus(
operationId,
blockchain,
Expand Down Expand Up @@ -61,7 +65,7 @@ class ValidateAssetCommand extends Command {
await this.handleError(
operationId,
blockchain,
`Invalid assertion id for asset ${ual}. Received value from blockchain: ${blockchainAssertionId}, received value from request: ${cachedData.public.assertionId}`,
`Invalid assertion id for asset ${ual} and operation with id ${operationId}. Received value from blockchain: ${blockchainAssertionId}, received value from request: ${cachedData.public.assertionId}`,
this.errorType,
true,
);
Expand Down
2 changes: 1 addition & 1 deletion src/commands/protocols/common/find-nodes-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class FindNodesCommand extends Command {
await this.handleError(
operationId,
blockchain,
`Unable to find enough nodes for operationId: ${operationId}, keyword: ${keyword}. Minimum number of nodes required: ${minAckResponses}`,
`Unable to find enough nodes for operationId: ${operationId}, keyword: ${keyword}. Minimum number of nodes required: ${minAckResponses}, number of nodes found: ${closestNodes.length}`,
this.errorType,
true,
);
Expand Down
6 changes: 5 additions & 1 deletion src/commands/protocols/common/protocol-message-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ class ProtocolMessageCommand extends Command {

const keywordUuid = uuidv5(keyword, uuidv5.URL);

this.logger.debug(
`Sending protocol message with operation id: ${operationId}, keyword uuidv5: ${keywordUuid}`,
);

const response = await this.networkModuleManager.sendMessage(
node.protocol,
node.id,
Expand All @@ -52,7 +56,7 @@ class ProtocolMessageCommand extends Command {
default:
await this.markResponseAsFailed(
command,
`Received unknown message type from node during ${command.name}`,
`Received unknown message type from node during ${command.name}. Unknown message type: ${response.header.messageType}`,
);
return Command.empty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class DeletePendingStateCommand extends Command {

this.logger.trace(
`Started ${command.name} for blockchain: ${blockchain} contract: ${contract}, ` +
`token id: ${tokenId}, assertion id: ${assertionId}`,
`token id: ${tokenId}, assertion id: ${assertionId}, operation id: ${operationId}` +
`keyword: ${keyword}, hash function id: ${hashFunctionId}`,
);

const pendingStateExists = await this.pendingStateExists(
Expand Down Expand Up @@ -73,6 +74,9 @@ class DeletePendingStateCommand extends Command {
}
await this.deletePendingState(blockchain, contract, tokenId, assertionId, operationId);
}
this.logger.trace(
`No pending state found for operation id: ${operationId} and assertion id`,
);
return Command.empty();
}

Expand Down Expand Up @@ -111,6 +115,7 @@ class DeletePendingStateCommand extends Command {
return true;
}
}
this.logger.debug(`No pending state exists for assertion id: ${assertionId}`);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add operation id

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

operationId does not exist in this method

return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class PublishController extends BaseController {
const hashFunctionId = req.body.hashFunctionId ?? CONTENT_ASSET_HASH_FUNCTION_ID;

this.logger.info(
`Received asset with assertion id: ${assertionId}, blockchain: ${blockchain}, hub contract: ${contract}, token id: ${tokenId}`,
`[PUBLISH] Received asset with assertion id: ${assertionId}, blockchain: ${blockchain}, hub contract: ${contract}, token id: ${tokenId}. Hash function id: ${hashFunctionId}`,
);

const operationId = await this.operationIdService.generateOperationId(
Expand Down
2 changes: 1 addition & 1 deletion src/service/operation-id-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class OperationIdService {
}

async cacheOperationIdData(operationId, data) {
this.logger.debug(`Caching data for operation id: ${operationId} in file`);
this.logger.trace(`Caching data for operation id: ${operationId} in file.`);
const operationIdCachePath = this.fileService.getOperationIdCachePath();

await this.fileService.writeContentsToFile(
Expand Down
5 changes: 5 additions & 0 deletions src/service/ual-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ class UALService {
tokenId,
0,
));

this.logger.debug(
`Calculating location keyword for blockchain: ${blockchain}, contract ${contract}, assertion id: ${assertionId}`,
);

return this.blockchainModuleManager.encodePacked(
blockchain,
['address', 'bytes32'],
Expand Down
Loading