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): streamline logging #10630

Merged
merged 12 commits into from Apr 3, 2019
Merged

chore(logger): streamline logging #10630

merged 12 commits into from Apr 3, 2019

Conversation

SimonSchick
Copy link
Contributor

@SimonSchick SimonSchick commented Mar 26, 2019

Pull Request check-list

Please make sure to review and check all of these items:

  • Does npm run test or npm run test-DIALECT pass with this change (including linting)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Have you added new tests to prevent regressions?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Did you follow the commit message conventions explained in CONTRIBUTING.md?

Description of change

Replaces debug package with debuglog native and acts as a foundation for #10284 (comment)

cc @javiertury

#Fixes 10661

@eseliger
Copy link
Member

Looking good so far, but the build is failing

@SimonSchick
Copy link
Contributor Author

hnnng

@codecov
Copy link

codecov bot commented Mar 27, 2019

Codecov Report

Merging #10630 into master will increase coverage by 0.11%.
The diff coverage is 95.45%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10630      +/-   ##
==========================================
+ Coverage   96.18%    96.3%   +0.11%     
==========================================
  Files          93       93              
  Lines        9011     8976      -35     
==========================================
- Hits         8667     8644      -23     
+ Misses        344      332      -12
Impacted Files Coverage Δ
lib/dialects/abstract/connection-manager.js 90.17% <100%> (ø) ⬆️
lib/model.js 96.67% <100%> (ø) ⬆️
lib/dialects/mysql/connection-manager.js 96.36% <100%> (ø) ⬆️
lib/dialects/mysql/query.js 98.3% <100%> (-0.07%) ⬇️
lib/dialects/sqlite/query.js 98.64% <100%> (-0.04%) ⬇️
lib/dialects/abstract/query.js 91.05% <100%> (+0.4%) ⬆️
lib/dialects/sqlite/connection-manager.js 100% <100%> (ø) ⬆️
lib/hooks.js 96.96% <100%> (ø) ⬆️
lib/data-types.js 91.28% <100%> (+0.03%) ⬆️
lib/dialects/mariadb/connection-manager.js 100% <100%> (ø) ⬆️
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ab7a954...3a8e5b4. Read the comment docs.

Copy link
Member

@eseliger eseliger left a comment

Choose a reason for hiding this comment

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

🌟

Copy link
Contributor

@sushantdhiman sushantdhiman left a comment

Choose a reason for hiding this comment

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

This is a breaking change I am afraid, it will break if someone is using debug specific logging features.

What are the advantages of this? With debug you can filter out different type of logging. If you want only pool logging you can set DEBUG=sequelize:pool* etc, is that possible with debuglog?

@javiertury javiertury mentioned this pull request Mar 27, 2019
5 tasks
@SimonSchick
Copy link
Contributor Author

@SimonSchick
Copy link
Contributor Author

I actually went ahead and streamlined all query logging into a single method sequelize.logQuery that handles both debug and regular logging mechanisms.
I also managed to purge a good amount of duplication while doing so.

Please note that it's relatively easy to bring back the debug package if that's highly desired.

@eseliger
Copy link
Member

to me this looks very clean and like the way we want to be headed to. So if you guys feel like this is a breaking change I'd still be up for pushing this for a v6 release instead 🤔

@SimonSchick
Copy link
Contributor Author

I don't think this is breaking btw, in no place sequelize states that it uses debug or that you can use DEBUG=sequelize as env do enable debugging, it's not part of any public interfaces either.

@eseliger
Copy link
Member

I'm totally up for merging this, but the build is broken again 😔

@SimonSchick
Copy link
Contributor Author

Heck.

@sushantdhiman
Copy link
Contributor

This is a breaking change and can't be merged. Even if docs are lacking that we support debug I am sure many are using this feature since we added support for debug. Also the environment variable for logs will be changed from DEBUG to NODE_DEBUG

@SimonSchick
Copy link
Contributor Author

Imo the only breaking change is the change in any public documentation or otherwise explicitly exposed format.

How would anyone know you can use debug if it's not in the docs?
They'd have to inspect the actual code to figure that out, and add that point 99% of developers would probably just add console.log at that point or use the logging option instead.

I have reverted it but please consider documenting the things you want developers to use/know about.

Copy link
Contributor

@sushantdhiman sushantdhiman left a comment

Choose a reason for hiding this comment

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

Unifying query logging logic is a good idea, I have left some suggestions. Other changes for logger class can be reverted

lib/utils/logger.js Outdated Show resolved Hide resolved
lib/sequelize.js Outdated Show resolved Hide resolved
@SimonSchick
Copy link
Contributor Author

Boiled it down a little, the DebugContext class was a remnant of me trying make logging more lazy, ended up not using it.

@SimonSchick SimonSchick changed the title chore(logger): use native logger chore(logger): streamline logging Mar 30, 2019
@SimonSchick
Copy link
Contributor Author

SimonSchick commented Mar 30, 2019

@sushantdhiman snug in a fix for #10661

Disregard that, needs more work, will be another PR.

…nel all logging through sequelize.logQuery"

This reverts commit 5fd9078.
lib/utils/logger.js Outdated Show resolved Hide resolved
…): channel all logging through sequelize.logQuery"
…logging): channel all logging through sequelize.logQuery"
lib/utils/logger.js Outdated Show resolved Hide resolved
…! feat(logging): channel all logging through sequelize.logQuery"
Copy link
Contributor

@sushantdhiman sushantdhiman left a comment

Choose a reason for hiding this comment

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

👍

@sushantdhiman sushantdhiman merged commit 7445423 into master Apr 3, 2019
@sushantdhiman sushantdhiman deleted the chore/native-log branch April 3, 2019 08:54
@sushantdhiman
Copy link
Contributor

🎉 This PR is included in version 5.2.11 🎉

The release is available on:

Your semantic-release bot 📦🚀

eseliger pushed a commit that referenced this pull request Apr 11, 2019
Rename postgresql query debug namespace (mistake in #10630)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants