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

feat(utils): Convert Logger class to functions #4863

Merged
merged 2 commits into from
Apr 6, 2022

Conversation

AbhiPrasad
Copy link
Member

@AbhiPrasad AbhiPrasad commented Apr 5, 2022

Dependent on #4860

Based on work in #4285

Removes the logger class in favour of a function + object. They are functionality identical. While I was here, took the liberty to refactor consoleSandbox a little, mainly adjusting the types.

Resolves https://getsentry.atlassian.net/browse/WEB-604

Note: This can be merged before v7 because @sentry/utils is not considered public API.

@AbhiPrasad AbhiPrasad force-pushed the v7-abhi-logger-functions branch 3 times, most recently from 94a679b to 4d489e5 Compare April 5, 2022 19:21
@AbhiPrasad AbhiPrasad changed the title feat(utils): Convert Logger class to functions [v7] feat(utils): Convert Logger class to functions Apr 5, 2022
@AbhiPrasad AbhiPrasad changed the title [v7] feat(utils): Convert Logger class to functions feat(utils): Convert Logger class to functions Apr 5, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Apr 5, 2022

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 20.13 KB (-0.54% 🔽)
@sentry/browser - ES5 CDN Bundle (minified) 64.59 KB (-0.9% 🔽)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.85 KB (-0.26% 🔽)
@sentry/browser - ES6 CDN Bundle (minified) 57.95 KB (-0.35% 🔽)
@sentry/browser - Webpack (gzipped + minified) 23.22 KB (-0.12% 🔽)
@sentry/browser - Webpack (minified) 81.69 KB (-0.53% 🔽)
@sentry/react - Webpack (gzipped + minified) 23.26 KB (-0.12% 🔽)
@sentry/nextjs Client - Webpack (gzipped + minified) 48.04 KB (-0.04% 🔽)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.06 KB (-0.43% 🔽)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 24.47 KB (-0.24% 🔽)

*
* @param callback The function to run against the original `console` messages
* @returns The results of the callback
*/
export function consoleSandbox(callback: () => any): any {
export function consoleSandbox<T>(callback: () => T): T {
Copy link
Member Author

Choose a reason for hiding this comment

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

as a next step, we can further refactor consoleSandbox to take a level argument, so we don't have to un-patch and re-patch every single console level every time we call this.

Base automatically changed from abhi-get-global-singleton to master April 6, 2022 02:19
@AbhiPrasad AbhiPrasad marked this pull request as ready for review April 6, 2022 02:20
@AbhiPrasad
Copy link
Member Author

Seems Node 6 tests are failing because global.console is undefined. But we guard against it 🤔. Will keep investigating.

Copy link
Member

@lforst lforst left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks for cleaning up!

@AbhiPrasad AbhiPrasad merged commit b1f4fbc into master Apr 6, 2022
@AbhiPrasad AbhiPrasad deleted the v7-abhi-logger-functions branch April 6, 2022 18:39
@pkuczynski
Copy link
Contributor

@AbhiPrasad I believe this caused #4878

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.

None yet

3 participants