Skip to content
This repository was archived by the owner on Dec 8, 2022. It is now read-only.

Exposing the log flag and integrating with better logging plugin #357

Merged
merged 18 commits into from
Mar 16, 2018

Conversation

Blackbaud-BobbyEarl
Copy link

@Blackbaud-BobbyEarl Blackbaud-BobbyEarl commented Feb 3, 2018

This PR does a few things...

  • Make sure all files use internal logger class, instead of loading winston directly.
  • Adjusts internal logger class to support the --logColor flag. This will be useful in our VSTS build logs where color is not supported.
  • Disables showLevel for the winston transport. This means no more info: ... before every log entry.
  • Using a new webpack logger that support log levels: none (custom), minimal, compact, expanded, and verbose. See simple-progress-webpack-plugin. Currently pointing to my fork until @dominique-mueller has the opportunity to release.

@blackbaud-johnly tagging you as this would require entries for the --logLevel, --logColor, and logFormat flags.

@codecov-io
Copy link

codecov-io commented Feb 3, 2018

Codecov Report

Merging #357 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #357      +/-   ##
==========================================
+ Coverage   99.24%   99.25%   +<.01%     
==========================================
  Files          73       72       -1     
  Lines        1732     1737       +5     
  Branches      279      282       +3     
==========================================
+ Hits         1719     1724       +5     
  Misses         13       13
Flag Coverage Δ
#builder 100% <100%> (ø) ⬆️
#runtime 94.77% <ø> (ø) ⬆️
#srcapp 100% <ø> (ø) ⬆️
Impacted Files Coverage Δ
cli/version.js 100% <100%> (ø) ⬆️
cli/utils/run-compiler.js 100% <100%> (ø) ⬆️
cli/utils/server.js 100% <100%> (ø) ⬆️
cli/pact.js 100% <100%> (ø) ⬆️
cli/utils/ts-linter.js 100% <100%> (ø) ⬆️
cli/e2e.js 100% <100%> (ø) ⬆️
config/sky-pages/sky-pages.config.js 100% <100%> (ø) ⬆️
lib/a11y-analyzer.js 100% <100%> (ø) ⬆️
loader/sky-processor/index.js 100% <100%> (ø) ⬆️
cli/utils/config-resolver.js 100% <100%> (ø) ⬆️
... and 6 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 1846f35...7602ec7. Read the comment docs.


// Supporting a custom logging type of none
if (argv.log !== 'none') {
const log = skyPagesConfig.runtime.command === 'serve' ? 'compact' : 'expanded';

Choose a reason for hiding this comment

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

Is the intent that skyux build should produce the "expanded" logs? I use skyux build -s often, and it add a ton of logs to the terminal. Curious if you thought about making the log level default to "compact" and put the option in skyuxconfig.json instead? This would allow control of the log level globally, but could be overwritten in command-specific config files.

Choose a reason for hiding this comment

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

Apologies as that is a bit vague. compact and expanded produce the same logging, only difference is compact does it all on a single line. This is good for local development, but of any "CI" it would not be a good experience. https://github.com/dominique-mueller/simple-progress-webpack-plugin#compact

I am making the assumption here that if you're running build, you're probably on a CI. Obviously, you can run build locally, but seemed like the safer default to set.

Allowing the default to be set in skyuxconfig.json might not be a bad idea, as long as the command line overrides it. This would mean users could get verbose logging on the build machine without altering their build definition, which would be nice.

@Blackbaud-SteveBrush
Copy link
Member

@Blackbaud-BobbyEarl Just one comment. I like that all logging goes through a single source now!

@Blackbaud-BobbyEarl
Copy link
Author

@Blackbaud-SteveBrush I believe this is ready for another look. Since you first approved, I've solidifed on --logColor, --logLevel, and --logFormat as the available options. I've also migrated the logging code to @blackbaud/skyux-logger.

package.json Outdated
@@ -44,7 +44,12 @@
"@angular/router": "4.3.6",
"@blackbaud/auth-client": "2.2.0",
"@blackbaud/skyux-lib-help": "1.1.0",
"@blackbaud/skyux-logger": "1.0.0",

Choose a reason for hiding this comment

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

I'm assuming we'll need to update this version once your patch gets in. Happy to approve the pull request once it gets released!

@Blackbaud-BobbyEarl Blackbaud-BobbyEarl merged commit 425a5e3 into master Mar 16, 2018
@Blackbaud-BobbyEarl Blackbaud-BobbyEarl deleted the expose-log-flag branch March 16, 2018 20:19
Blackbaud-MikitaYankouski pushed a commit to Blackbaud-MikitaYankouski/skyux-builder that referenced this pull request May 3, 2019
…ckbaud#357)

* Exposing the log flag and integrating with better logging plugin

* Using expanded logging in Travis

* Adding support for custom --log none

* Cleaned up logging

* Fixed tests

* Consistently using logger. Disabled native stats.

* Cleaned up logging.  Pointing to fork (until dep release)

* Cleaned up defaults + tests

* Fixed bug.  Cleaned up logging

* Incorporated feedback to use logColor, logLevel, and logFormat flags

* Updated to @blackbaud/skyux-logger 1.0.1

* Removed failing test as it was testing internal logger functionality
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants