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/release/devnet
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 7 additions & 0 deletions src/commands/local-store/local-store-command.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ class LocalStoreCommand extends Command {
if (storeType === LOCAL_STORE_TYPES.TRIPLE) {
const storePromises = [];
if (cachedData.public.assertion && cachedData.public.assertionId) {
this.logger.debug(
zsculac marked this conversation as resolved.
Show resolved Hide resolved
`Storing public assertion id: ${cachedData.public.assertionId}`,
);

storePromises.push(
this.tripleStoreService.localStoreAsset(
TRIPLE_STORE_REPOSITORIES.PRIVATE_CURRENT,
Expand All @@ -62,6 +66,9 @@ class LocalStoreCommand extends Command {
);
}
if (cachedData.private.assertion && cachedData.private.assertionId) {
this.logger.debug(
zsculac marked this conversation as resolved.
Show resolved Hide resolved
`Storing private assertion id: ${cachedData.private.assertionId}`,
);
storePromises.push(
this.tripleStoreService.localStoreAsset(
TRIPLE_STORE_REPOSITORIES.PRIVATE_CURRENT,
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,7 @@ class DeletePendingStateCommand extends Command {
}
await this.deletePendingState(blockchain, contract, tokenId, assertionId, operationId);
}
this.logger.trace(`No pending state found`);
zsculac marked this conversation as resolved.
Show resolved Hide resolved
return Command.empty();
}

Expand Down Expand Up @@ -111,6 +113,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
Contributor 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
1 change: 1 addition & 0 deletions src/service/file-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ class FileService {
}

getParentDirectory(filePath) {
this.logger.trace(`Parent directory: ${path.dirname(filePath)}`);
zsculac marked this conversation as resolved.
Show resolved Hide resolved
return path.dirname(filePath);
}
}
Expand Down
8 changes: 7 additions & 1 deletion src/service/operation-id-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ class OperationIdService {

this.emitChangeEvent(status, operationId, blockchain, errorMessage, errorType);

this.logger.debug(
zsculac marked this conversation as resolved.
Show resolved Hide resolved
`Updated operation id status: ${status}. Operation id: ${operationId}, blockchain: ${blockchain}`,
);

await this.repositoryModuleManager.updateOperationIdRecord(response, operationId);
}

Expand Down Expand Up @@ -102,7 +106,9 @@ class OperationIdService {
}

async cacheOperationIdData(operationId, data) {
this.logger.debug(`Caching data for operation id: ${operationId} in file`);
this.logger.debug(
`Caching data for operation id: ${operationId} in file. Data to be cached: ${data}`,
zsculac marked this conversation as resolved.
Show resolved Hide resolved
);
const operationIdCachePath = this.fileService.getOperationIdCachePath();

await this.fileService.writeContentsToFile(
Expand Down
2 changes: 2 additions & 0 deletions src/service/pending-storage-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class PendingStorageService {
tokenId,
);

this.logger.debug(`Pending storage folder path: ${pendingStorageFolderPath}`);
zsculac marked this conversation as resolved.
Show resolved Hide resolved

await this.fileService.writeContentsToFile(
pendingStorageFolderPath,
assertionId,
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