Skip to content

Commit 2e4f552

Browse files
authored
fix: adjust logger levels to ensure correct logging (#1577)
1 parent 0a3f148 commit 2e4f552

File tree

11 files changed

+31
-31
lines changed

11 files changed

+31
-31
lines changed

packages/cardano-services-client/src/ChainHistoryProvider/BlockfrostChainHistoryProvider.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ export class BlockfrostChainHistoryProvider extends BlockfrostProvider implement
153153
return this.fetchCBOR(hash)
154154
.then((cbor) => {
155155
const tx = Serialization.Transaction.fromCbor(Serialization.TxCBOR(cbor)).toCore();
156-
this.logger.info('Fetched details from CBOR for tx', hash);
156+
this.logger.debug('Fetched details from CBOR for tx', hash);
157157
return tx;
158158
})
159159
.catch((error) => {
@@ -498,7 +498,7 @@ export class BlockfrostChainHistoryProvider extends BlockfrostProvider implement
498498
pagination,
499499
blockRange
500500
}: TransactionsByAddressesArgs): Promise<Paginated<Cardano.HydratedTx>> {
501-
this.logger.info(`transactionsByAddresses: ${JSON.stringify(blockRange)} ${JSON.stringify(addresses)}`);
501+
this.logger.debug(`transactionsByAddresses: ${JSON.stringify(blockRange)} ${JSON.stringify(addresses)}`);
502502
try {
503503
const lowerBound = blockRange?.lowerBound ?? 0;
504504
const upperBound = blockRange?.upperBound ?? DB_MAX_SAFE_INTEGER;

packages/cardano-services-client/src/UtxoProvider/BlockfrostUtxoProvider.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export class BlockfrostUtxoProvider extends BlockfrostProvider implements UtxoPr
3636
const result = await this.fetchCBOR(hash)
3737
.then((cbor) => {
3838
const tx = Serialization.Transaction.fromCbor(Serialization.TxCBOR(cbor)).toCore();
39-
this.logger.info('Fetched details from CBOR for tx', hash);
39+
this.logger.debug('Fetched details from CBOR for tx', hash);
4040
return tx;
4141
})
4242
.catch((error) => {

packages/cardano-services-client/src/WebSocket.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ export class CardanoWsClient extends WsProvider {
401401
};
402402

403403
ws.onclose = () => {
404-
this.logger.info('WebSocket client connection closed', this.clientId);
404+
this.logger.debug('WebSocket client connection closed', this.clientId);
405405

406406
if (this.heartbeatTimeout) {
407407
clearInterval(this.heartbeatTimeout);

packages/e2e/src/factories.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ export const getWallet = async (props: GetWalletProps) => {
623623
);
624624

625625
const [{ address, rewardAccount }] = await firstValueFrom(wallet.addresses$);
626-
logger.info(`Created wallet "${wallet.name}": ${address}/${rewardAccount}`);
626+
logger.debug(`Created wallet "${wallet.name}": ${address}/${rewardAccount}`);
627627

628628
const maxInterval =
629629
polling?.maxInterval ||
@@ -705,7 +705,7 @@ export const getSharedWallet = async (props: GetSharedWalletProps) => {
705705
);
706706

707707
const [{ address, rewardAccount }] = await firstValueFrom(wallet.addresses$);
708-
logger.info(`Created wallet "${wallet.name}": ${address}/${rewardAccount}`);
708+
logger.debug(`Created wallet "${wallet.name}": ${address}/${rewardAccount}`);
709709

710710
const maxInterval =
711711
polling?.maxInterval ||

packages/e2e/test/artillery/wallet-restoration/WalletRestoration.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ const extractAddresses = async (count: number): Promise<AddressesModel[]> => {
5454
throw new Error(`You can not restore more than ${dump.length} distinct wallets for ${network} network.`);
5555
}
5656
result = dump.slice(0, count);
57-
logger.info(`Selected subset of predefined ${network} addresses with count: ${result.length}.`);
57+
logger.debug(`Selected subset of predefined ${network} addresses with count: ${result.length}.`);
5858
} else if (env.DB_SYNC_CONNECTION_STRING) {
5959
const db = new Pool({ connectionString: env.DB_SYNC_CONNECTION_STRING });
60-
logger.info('About to query db for distinct addresses.');
60+
logger.debug('About to query db for distinct addresses.');
6161
result = (await db.query(findAddressesWithRegisteredStakeKey, [count])).rows;
6262
if (result.length < count) {
6363
throw new Error(`Addresses found from db are less than desired wallets count of ${count}`);
6464
}
65-
logger.info(`Found DB addresses count: ${result.length}`);
65+
logger.debug(`Found DB addresses count: ${result.length}`);
6666
} else {
6767
throw new Error('Please provide a valid KEY_MANAGEMENT_PARAMS or DB_SYNC_CONNECTION_STRING env variable.');
6868
}
@@ -84,7 +84,7 @@ let index = 0;
8484

8585
export const walletRestoration: FunctionHook<WalletVars> = async ({ vars, _uid }, ee, done) => {
8686
const currentAddress = vars.addresses[index];
87-
logger.info(`Current address: ${currentAddress.address}`);
87+
logger.debug(`Current address: ${currentAddress.address}`);
8888
++index;
8989

9090
try {
@@ -109,7 +109,7 @@ export const walletRestoration: FunctionHook<WalletVars> = async ({ vars, _uid }
109109
ee.emit('histogram', `${operationName}.time`, Date.now() - startedAt);
110110
ee.emit('counter', operationName, 1);
111111

112-
logger.info(
112+
logger.debug(
113113
`Wallet with name ${vars.currentWallet.name} and address ${currentAddress.address} was successfully restored`
114114
);
115115
} catch (error) {
@@ -124,6 +124,6 @@ export const walletRestoration: FunctionHook<WalletVars> = async ({ vars, _uid }
124124

125125
export const shutdownWallet: FunctionHook<WalletVars> = async ({ vars, _uid }, _ee, done) => {
126126
vars.currentWallet?.shutdown();
127-
logger.info(`Wallet with VU id ${_uid} was shutdown`);
127+
logger.debug(`Wallet with VU id ${_uid} was shutdown`);
128128
done();
129129
};

packages/e2e/test/web-extension/extension/background/cip30.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ import { walletName } from '../const';
1212
const confirmationCallback: walletCip30.CallbackConfirmation = {
1313
signData: async ({ sender }) => {
1414
if (!sender) throw new Error('No sender context');
15-
logger.info('signData request from', sender);
15+
logger.debug('signData request from', sender);
1616
return { cancel$: NEVER };
1717
},
1818
signTx: async ({ sender }) => {
1919
if (!sender) throw new Error('No sender context');
20-
logger.info('signTx request', sender);
20+
logger.debug('signTx request', sender);
2121
return { cancel$: NEVER };
2222
},
2323
submitTx: async () => true

packages/ogmios/src/CardanoNode/OgmiosObservableCardanoNode/OgmiosObservableCardanoNode.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const stateQueryRetryBackoffConfig = (
9090
...retryConfig,
9191
shouldRetry: (error) => {
9292
if (retryableStateQueryErrors.has(CardanoNodeUtil.asCardanoNodeError(error)?.code)) {
93-
logger.info('Local state query unavailable yet, will retry...');
93+
logger.debug('Local state query unavailable yet, will retry...');
9494
return true;
9595
}
9696
return false;

packages/ogmios/src/CardanoNode/queries.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,15 @@ export const withCoreCardanoNodeError = async <T>(operation: () => Promise<T>) =
138138

139139
export const queryEraSummaries = (client: LedgerStateQuery.LedgerStateQueryClient, logger: Logger) =>
140140
withCoreCardanoNodeError(async () => {
141-
logger.info('Querying era summaries');
141+
logger.debug('Querying era summaries');
142142
const systemStart = new Date((await client.genesisConfiguration('byron')).startTime);
143143
const eraSummaries = await client.eraSummaries();
144144
return eraSummaries.map((era) => eraSummary(era, systemStart));
145145
});
146146

147147
export const queryGenesisParameters = (client: LedgerStateQuery.LedgerStateQueryClient, logger: Logger) =>
148148
withCoreCardanoNodeError(async () => {
149-
logger.info('Querying genesis parameters');
149+
logger.debug('Querying genesis parameters');
150150
// Update this to query multiple eras if the CompactGenesis type will have to include params from other eras
151151
return genesis(await client.genesisConfiguration('shelley'));
152152
});

packages/util/src/RunnableModule.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -48,46 +48,46 @@ export abstract class RunnableModule {
4848
throw new InvalidModuleState<RunnableModuleState>(this.name, 'initializeBefore', null);
4949
}
5050
this.state = 'initializing';
51-
this.logger.info('Initializing...');
51+
this.logger.debug('Initializing...');
5252
}
5353

5454
initializeAfter() {
5555
if (this.state !== 'initializing') {
5656
throw new InvalidModuleState<RunnableModuleState>(this.name, 'initializeAfter', 'initializing');
5757
}
5858
this.state = 'initialized';
59-
this.logger.info('Initialized');
59+
this.logger.debug('Initialized');
6060
}
6161

6262
startBefore() {
6363
if (this.state !== 'initialized') {
6464
throw new InvalidModuleState<RunnableModuleState>(this.name, 'start', 'initialized');
6565
}
6666
this.state = 'starting';
67-
this.logger.info('Starting...');
67+
this.logger.debug('Starting...');
6868
}
6969

7070
startAfter() {
7171
if (this.state !== 'starting') {
7272
throw new InvalidModuleState<RunnableModuleState>(this.name, 'start', 'starting');
7373
}
7474
this.state = 'running';
75-
this.logger.info('Started');
75+
this.logger.debug('Started');
7676
}
7777

7878
shutdownBefore() {
7979
if (this.state !== 'running') {
8080
throw new InvalidModuleState<RunnableModuleState>(this.name, 'shutdown', 'running');
8181
}
8282
this.state = 'stopping';
83-
this.logger.info('Stopping...');
83+
this.logger.debug('Stopping...');
8484
}
8585

8686
shutdownAfter() {
8787
if (this.state !== 'stopping') {
8888
throw new InvalidModuleState<RunnableModuleState>(this.name, 'shutdown', 'stopping');
8989
}
9090
this.state = 'initialized';
91-
this.logger.info('Shutdown complete');
91+
this.logger.debug('Shutdown complete');
9292
}
9393
}

packages/util/test/RunnableModule.test.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe('RunnableModule', () => {
3535
it('optionally takes a logger on construction', () => {
3636
const runnableModule = new SomeRunnableModule(logger);
3737
expect(runnableModule.state).toBeNull();
38-
expect(logger.info).not.toHaveBeenCalled();
38+
expect(logger.debug).not.toHaveBeenCalled();
3939
});
4040
});
4141
describe('initialize', () => {
@@ -49,11 +49,11 @@ describe('RunnableModule', () => {
4949
expect(runnableModule.state).toBeNull();
5050
await runnableModule.initialize();
5151
expect(runnableModule.state).toBe('initialized');
52-
expect(logger.info).toHaveBeenCalled();
52+
expect(logger.debug).toHaveBeenCalled();
5353
jest.resetAllMocks();
5454
await expect(runnableModule.initialize()).rejects.toThrowError(InvalidModuleState);
5555
expect(runnableModule.state).toBe('initialized');
56-
expect(logger.info).not.toHaveBeenCalled();
56+
expect(logger.debug).not.toHaveBeenCalled();
5757
});
5858
});
5959

@@ -68,12 +68,12 @@ describe('RunnableModule', () => {
6868
it('changes state if initialized and not already in progress, and logs info', async () => {
6969
expect(runnableModule.state).toBe('initialized');
7070
await runnableModule.start();
71-
expect(logger.info).toHaveBeenCalled();
71+
expect(logger.debug).toHaveBeenCalled();
7272
expect(runnableModule.state).toBe('running');
7373
jest.resetAllMocks();
7474
await expect(runnableModule.initialize()).rejects.toThrowError(InvalidModuleState);
7575
expect(runnableModule.state).toBe('running');
76-
expect(logger.info).not.toHaveBeenCalled();
76+
expect(logger.debug).not.toHaveBeenCalled();
7777
});
7878
});
7979

@@ -89,13 +89,13 @@ describe('RunnableModule', () => {
8989
it('changes state if running and not already in progress, and logs info', async () => {
9090
expect(runnableModule.state).toBe('running');
9191
await runnableModule.shutdown();
92-
expect(logger.info).toHaveBeenCalled();
92+
expect(logger.debug).toHaveBeenCalled();
9393
expect(runnableModule.state).toBe('initialized');
9494
jest.resetAllMocks();
9595
await expect(runnableModule.initialize()).rejects.toThrowError(InvalidModuleState);
9696
await expect(runnableModule.shutdown()).rejects.toThrowError(InvalidModuleState);
9797
expect(runnableModule.state).toBe('initialized');
98-
expect(logger.info).not.toHaveBeenCalled();
98+
expect(logger.debug).not.toHaveBeenCalled();
9999
});
100100
});
101101
});

packages/web-extension/src/walletManager/SigningCoordinator/SigningCoordinator.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export class SigningCoordinator<WalletMetadata extends {}, AccountMetadata exten
9797
walletType: requestContext.wallet.type
9898
},
9999
(keyAgent) => {
100-
this.#logger.info('Signing transaction', transaction.getId());
100+
this.#logger.debug('Signing transaction', transaction.getId());
101101
return keyAgent.signTransaction(transaction.body(), signContext, options);
102102
}
103103
);

0 commit comments

Comments
 (0)