-
Notifications
You must be signed in to change notification settings - Fork 74
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: showOutput option & log function #185
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@santoshjoseph99 , huge 👍
logFunc is my dream we can have instead of console.log/console.error
I have only one concern about putting it as param when we call one or another method which needs log something
what do you think if we create class Logger, which will be singleton? By default, it will have flag showOutput: true
.
Logger
will have API aka log
with params log(message, type)
, (type - will be success, error, etc)
setShowOutput
can change showOutput
flag value which will be used in scope of log
to show or not message.
As result we can eliminate something like e.g. prepareData(events, logFunc);
for each function and just import class Logger
@denar90 sounds good. I'll update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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:
? |
Moving thread here,
Sorry, for the confusion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a looot 👍
v3.3.0 published to npm 🎉 |
🆒 |
Related to #184
Test file:
https://gist.github.com/santoshjoseph99/c796663002b03812cc197fe1f8bb8d38
Note:
logFunc
to check if the message is alog
or anerror
, since right now I'm just usingconsole.log
.logFunc
can be passed intoPWMetrics
as part of theoptions
, so it gives more control to the caller on how to show the messages.