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
Logger abstraction #36
Conversation
For now, just returns a reference to the console
Instead of passing console around, all files that need the logger pull it directly from logger.ts
Updated the tests for all changed files to mock the logger file
Coverage report
Show new covered files 🐣
Test suite run success89 tests passing in 18 suites. Report generated by 🧪jest coverage report action from a7e74a6 |
Co-authored-by: James Robinson <1500092+AverageHelper@users.noreply.github.com>
I forgot some parts. I'll be pushing more changes soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making a personal note here- we probably should have merged this in before xkcd
. I'll need to go back and make sure that the logging there is up to date.
Since you just merged main into this branch, I can go and edit xkcd's code before merging. |
The logger was already partially abstracted before, but it required passing logger around through parameters in methods. This was causing problems for event handler abstraction.
Now the logger is in a separate file called
logger.ts
that contains a method that returns the logger to use (the console, for now). We use a method instead of a constant to make mocking easier for tests.All files that used the logger before now pull the logger from
logger.ts
instead of passing through parameters. I also updated tests to reflect this fact by mockinglogger.ts
.