Description
Currently, the MongoWatcherCollection class uses direct console.warn and console.error calls for logging. As suggested in PR #880, we should replace these with a proper logger for better context and log routing when logs are written to a file.
Proposed Solution
Modify the MongoWatcherCollection class to:
- Accept an optional logger parameter in the constructor
- Default to using console if no logger is provided
- Replace all direct console.warn and console.error calls with the logger
This will improve log handling and make the class more flexible while maintaining compatibility with current usage.
References
Description
Currently, the MongoWatcherCollection class uses direct console.warn and console.error calls for logging. As suggested in PR #880, we should replace these with a proper logger for better context and log routing when logs are written to a file.
Proposed Solution
Modify the MongoWatcherCollection class to:
This will improve log handling and make the class more flexible while maintaining compatibility with current usage.
References