serverless-sentry-lib icon indicating copy to clipboard operation
serverless-sentry-lib copied to clipboard

Silent mode for local execution?

Open blelump opened this issue 5 years ago • 2 comments

Hi,

when playing within local environment, ie. running tests, plenty of:

  console.warn                                                                                                        
    Sentry disabled in local environment.

usually appear making the test output effectively unreadable. Maybe we could introduce some kind of a silent mode, where these warnings are disabled?

blelump avatar Sep 09 '20 06:09 blelump

Thanks for your suggestion. That would certainly make sense.

As a workaround, for local testing, you can redefine console.warn as an empty function:

console.log = () => {}; // mute console output for simpler test logs
console.error = () => {};
console.warn = () => {};
console.info = () => {};
console.debug = () => {};

This would disable all console output of the lib while the regular Mocha or Jest output should still work as expected.

arabold avatar Sep 09 '20 13:09 arabold

Thanks for reply.

Yeah, that's an option, however this is a global solution and will override the default behavior for any use of ie. console.warn. Since usage of ENV variables here is wide, maybe another one like SENTRY_SILENT_MODE would not be considered harmful?

blelump avatar Sep 10 '20 13:09 blelump