paulirish / pwmetrics

Progressive web metrics at your fingertipz
Apache License 2.0
1.25k stars 74 forks source link

feat: showOutput option & log function #185

Closed santoshjoseph99 closed 6 years ago

santoshjoseph99 commented 6 years ago

Related to https://github.com/paulirish/pwmetrics/issues/184

Test file: https://gist.github.com/santoshjoseph99/c796663002b03812cc197fe1f8bb8d38

Note:

  1. I could add a parameter to logFunc to check if the message is a log or an error, since right now I'm just using console.log.
  2. I could also set this up so that logFunc can be passed into PWMetrics as part of the options, so it gives more control to the caller on how to show the messages.
santoshjoseph99 commented 6 years ago

@denar90 sounds good. I'll update.

santoshjoseph99 commented 6 years ago

@denar90 I'm not sure what you mean by the land on the docs?

Also I'm seeing a failure in CI...should I change the signature of the log function to be:

  log(msg: any, ...args: any[]) {
    if(Logger.options.showOutput){
      console.log(msg, ...args);
    }
  }

?

denar90 commented 6 years ago

Moving thread here,


lgtm 👍 one nitpick, can you update docs so we can land it?

@denar90 I'm not sure what you mean by the land on the docs? Also I'm seeing a failure in CI...should I change the signature of the log function to be:

log(msg: any, ...args: any[]) {
if(Logger.options.showOutput){
console.log(msg, ...args);
}
}

?

Sorry, for the confusion. I meant that it will be nice if you can update readme.md about new flag. As result we can publish new version. And I'm ok with signature of the log function.

denar90 commented 6 years ago

v3.3.0 published to npm 🎉

santoshjoseph99 commented 6 years ago

🆒