tsayen / dom-to-image

Generates an image from a DOM node using HTML5 canvas
Other
10.32k stars 1.68k forks source link

Don't log to the console unless specified. #201

Open saborrie opened 6 years ago

saborrie commented 6 years ago

It's not good practice for libraries to log directly to the console unless a consumer sets a verbosity setting to enable it.

E.g. this piece of code in dom-to-image.js: (a non-fatal error of some stylesheets not working doesn't warrant an unsuppressible call to console.log)

try {
  util.asArray(sheet.cssRules || []).forEach(cssRules.push.bind(cssRules));
} catch (e) {
  console.log('Error while reading CSS rules from ' + sheet.href, e.toString());
}

There may be others places too.

rafagil commented 3 years ago

Hi @saborrie. Added a PR for this: #374