beaver-logger icon indicating copy to clipboard operation
beaver-logger copied to clipboard

Add disableBrowserLogging option #28

Open musps opened this issue 5 years ago • 6 comments

Hello,

From the issue #28, someone asked if it was possible to have an option to disable logs appearing in the browser console.

Option

option type default value
disableBrowserLogging boolean false

This option will disable the function print to be executed internally and will not print the logs in the browser console.

Usage

const $logger = Logger({
  url: '/test/api/log',
  disableBrowserLogging: true
});

musps avatar Oct 03 '20 16:10 musps

@mnicpt @bluepnume can you take a look at ^^?

mstuart avatar Oct 05 '20 20:10 mstuart

Yes. @musps I think disableBrowserLogging would be a better name since it's already enabled. Can you update this?

mnicpt avatar Oct 06 '20 10:10 mnicpt

@musps Can you revert the /dist changes. This will happen automatically when we publish.

mnicpt avatar Oct 06 '20 10:10 mnicpt

@mnicpt Both are done!

musps avatar Oct 06 '20 11:10 musps

any chance to release this enhancement soon?

zjye-idealhub avatar Dec 17 '20 05:12 zjye-idealhub

Thank you! looking forward for this PR to be merged as well!

One note, though, if it's not too much trouble I think it makes for a better API to have a browser log level instead of a flag. For our needs, for instance, it would be preferable to have only errors emitted to console and everything allowed by logLevel sent to BE. I guess this is not such a rare use case for other users as well.

You may even want to add a level above error (SUPPRESS? IGNORE?) which will cover the 'complete disable' use case, instead of another argument.

If required (provided you approve of this direction) I think I can make this change, building off @musps great work

orens avatar Dec 28 '20 12:12 orens