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: use logger #991

Merged
merged 4 commits into from Oct 27, 2021
Merged

feat: use logger #991

merged 4 commits into from Oct 27, 2021

Conversation

alexander-akait
Copy link
Member

This PR contains a:

  • bugfix
  • new feature
  • code refactor
  • test update
  • typo fix
  • metadata update

Motivation / Use-Case

Use webpack logger, so developer can see logs in stats

Breaking Changes

No

Additional Info

@nex3 Hello, I found couple problems with logger interface:

  1. Passing own logger doesn't disable stderr logger - Logger option not working if passed through sass-loader sass/dart-sass#1533
  2. Do we have already formatted message? As you can see in this PR we duplicate logic for message formatting from dart-sass (if I missed something please tell me), but honestly I didn't want to do this at all, will be great if logger interface has formattedMessage (maybe better name) or something similar, so we would just like to use it:
const myLogger = getMyLogger('sass-loader');
const loggerForSass = {
  warn(_, options) {
    myLogger.warn(options.formattedOutput)
  }
  degun(_, options) {
     myLogger.debug(options.formattedOutput)
  } 
}

@nex3
Copy link
Contributor

nex3 commented Oct 21, 2021

2. Do we have already formatted message? As you can see in this PR we duplicate logic for message formatting from dart-sass (if I missed something please tell me), but honestly I didn't want to do this at all, will be great if logger interface has formattedMessage (maybe better name) or something similar, so we would just like to use it:

We could add this. Do you want to submit a proposal for this to the Sass language repo?

@alexander-akait
Copy link
Member Author

Do you want to submit a proposal for this to the Sass language repo?

Sorry, I am very busy, will be glad if you help me with this, thanks

@codecov
Copy link

codecov bot commented Oct 27, 2021

Codecov Report

Merging #991 (5cfc796) into master (3498284) will decrease coverage by 0.05%.
The diff coverage is 95.45%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #991      +/-   ##
==========================================
- Coverage   96.18%   96.12%   -0.06%     
==========================================
  Files           4        4              
  Lines         262      284      +22     
  Branches       87       94       +7     
==========================================
+ Hits          252      273      +21     
- Misses          9       10       +1     
  Partials        1        1              
Impacted Files Coverage Δ
src/utils.js 95.45% <95.45%> (ø)

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 3498284...5cfc796. Read the comment docs.

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

2 participants