Skip to content

chore(logger): streamline logging - #10630

Merged
sushantdhiman merged 12 commits into
masterfrom
chore/native-log
Apr 3, 2019
Merged

sushantdhiman merged 12 commits into
masterfrom
chore/native-log

Conversation

@SimonSchick

@SimonSchick SimonSchick commented Mar 26, 2019 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Member

Looking good so far, but the build is failing

@SimonSchick

Copy link
Copy Markdown
Contributor Author

hnnng

@codecov

codecov Bot commented Mar 27, 2019 •

Copy link
Copy Markdown

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.

@eseliger eseliger left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🌟

@sushantdhiman sushantdhiman left a comment

Copy link
Copy Markdown
Contributor

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 done
@SimonSchick

Copy link
Copy Markdown
Contributor Author

@SimonSchick

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

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

@SimonSchick

Copy link
Copy Markdown
Contributor Author

Heck.

Comment thread lib/dialects/postgres/query.js Resolved
@eseliger
eseliger requested a review from sushantdhiman March 28, 2019 00:30
@sushantdhiman

Copy link
Copy Markdown
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
Copy Markdown
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.

@sushantdhiman sushantdhiman left a comment

Copy link
Copy Markdown
Contributor

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

Comment thread lib/utils/logger.js Resolved
Comment thread lib/sequelize.js Resolved
@SimonSchick

Copy link
Copy Markdown
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

SimonSchick commented Mar 30, 2019 •

Copy link
Copy Markdown
Contributor Author

@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.
Comment thread lib/utils/logger.js Resolved
Comment thread lib/utils/logger.js Resolved
Comment thread lib/dialects/abstract/query.js Resolved
Comment thread lib/dialects/mariadb/query.js Resolved
…): channel all logging through sequelize.logQuery"
…logging): channel all logging through sequelize.logQuery"
Comment thread lib/utils/logger.js Resolved
…! feat(logging): channel all logging through sequelize.logQuery"

@sushantdhiman sushantdhiman left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor

🎉 This PR is included in version 5.2.11 🎉

The release is available on:

Your semantic-release bot 📦🚀

@KillWolfVlad KillWolfVlad mentioned this pull request Apr 11, 2019
2 of 5 tasks
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.

3 participants