feat(logger): implement configurable logging system#264
Merged
Conversation
These will all be replaced with the debugging logger that will be introduced in this branch.
- Replaced `console.info`, `console.warn`, and `console.error` calls with appropriate logger methods (`this.logger.info`, `this.logger.warn`, `this.logger.error`, `this.logger.debug`) - Wrapped `signTransactions` method logic in a try/catch block to handle and log errors consistently - Ensured that all wallet clients leverage the scoped logger created in the `BaseWallet` class - Added more logging statements to provide better visibility into the wallets' operations
- Add detailed logging to `signTransactions` methods across wallet clients. - Include debug logs for transaction processing steps and results.
This commit refactors the createAlgodClient method in the WalletManager class to improve its functionality and logging. The main changes are: - Update method signature to accept `networkId` instead of `config` - Move network config retrieval inside the method - Adjust logging to use the passed `networkId` parameter These changes should resolve issues related to accessing the active network property on initialization and improve the overall structure of the method.
This commit updates the wallet test files to use the new `Logger` system instead of `console` logging. The main changes include: - Update mock setup for logger in all wallet test files - Replace `console.warn` and `console.error` expectations with `logger.warn` and `logger.error` in relevant tests - Adjust test assertions to check for `logger` calls instead of `console` calls - Remove unused `console` mocks from test files
- Replace `console.warn` calls with `logger.warn` in store functions - Update tests to mock the `logger` to suppress output during test runs
- Create new test file for `Logger` class - Implement tests for singleton instance, log levels, and scoped logging - Add `setIsClient` method to Logger for testing purposes - Ensure tests cover all logging scenarios and respect log levels
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces a centralized logging system to improve debugging and error tracking across the entire library. It replaces direct console logging with a new
Loggerclass that provides consistent, configurable logging functionality. The PR also adds new configuration options toWalletManagerfor fine-grained control over logging behavior.Details
Loggerclass with support for different log levels (DEBUG,INFO,WARN,ERROR)Loggerto ensure consistent usage across the applicationconsole.log,console.warn, andconsole.errorcalls with appropriate logger methodsLoggerclass to ensure proper functionalityWalletManager:logLevel(enum): Allows precise control over the log leveldebug(boolean): Convenience option to easily set log level toDEBUG