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

chore(logger): expose logger.__buffer__={}, add tests #69

Merged
merged 1 commit into from
Mar 6, 2023

Conversation

jamischarles
Copy link
Contributor

@jamischarles jamischarles commented Mar 3, 2023

This PR exposes the private buffers publicly (__buffer__={events=[],metrics=[],tracking=[]}) on the logger instance.

In 3.x this was exposed on $beaver but was removed in later versions.

Adding this allows us much greater flexibility in testing as well as allows consuming libraries to assert that they sent the correct events to the buffer for logging.

This change also allows us to add a lot more tests easily (code coverage jumped to 73%).

Before:
Screenshot 2023-03-03 at 13 02 28

After:
Screenshot 2023-03-03 at 13 04 00

New test cases added
Screenshot 2023-03-03 at 12 34 52

Copy link
Member

@wsbrunson wsbrunson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to back out the /dist folder changes?

@westeezy
Copy link
Contributor

westeezy commented Mar 6, 2023

Whoops put a few comments on dist files. I agree with @wsbrunson we will want to back those out since the publish does it automatically.

src/logger.js Outdated Show resolved Hide resolved
karma.conf.js Show resolved Hide resolved
3. Locally merge (or rebase) the upstream branch into your topic branch: `$ git pull upstream && git merge`.
4. Push your topic branch up to your fork: `$ git push origin <topic-branch-name>`.
5. Open a [Pull Request](https://help.github.com/articles/using-pull-requests) with a clear title and description.
1. Don't check in your `./dist` folder. You can use this command to ignore it without modifying the .gitignore file: `git update-index —assume-unchanged dist/*.*`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only change here: Added first line. Updated numbers

@jamischarles
Copy link
Contributor Author

@westeezy Made the recommended changes

src/logger.js Outdated Show resolved Hide resolved
@jamischarles jamischarles changed the title chore(logger): expose logger._buffer={}, add tests chore(logger): expose logger.__buffer__={}, add tests Mar 6, 2023
This commit exposes the private buffers publicly
_buffer={events=[],metrics=[],tracking=[]} on the logger instance.

In `3.x` this was exposed on `$beaver` but was removed in later
versions.

Adding this allows us much greater flexibility in testing as well as
allows consuming libraries to assert that they sent the correct events
to the buffer for logging.

This change also allows us to add a lot more tests easily (code coverage
jumped to 73%).
@jamischarles
Copy link
Contributor Author

All issues resolved. This should be good to go now. Thanks folks!

@wsbrunson wsbrunson merged commit 03cee51 into krakenjs:main Mar 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants