malsup / cycle2

2nd gen cycling
899 stars 236 forks source link

excess logging clutters console #669

Open sunilw opened 9 years ago

sunilw commented 9 years ago

First off: this plugin is fantastic. Thanks for developing it. It's my first choice of component for doing things like building wordpress slider plugins.

Using the minified messages are logged to console. I see output like this:

[cycle2] --c2 init--jquery.cycle2.min.js:6 [cycle2] speed: 400 (number)
jquery.cycle2.min.js:6 [cycle2] activeClass: active (string)
jquery.cycle2.min.js:6 [cycle2] random: true (boolean)
jquery.cycle2.min.js:6 [cycle2] slides: div (string)`

I can see how this is useful, but does this kind of logging need to be in the minified version?

My usual expectation is that logging messages are stripped out of minified scripts, because the minified version are more likely to be used in production. At that point, logging is unneccesary.

I'm finding that if I use the minified version and I'm debugging something else on the page, logging from the minified cycle2 clutters the console, making it a little more difficult to find my own logging messages.

Thanks.

malsup commented 9 years ago

The minified version is just that, a minified version. It doesn't make any changes to the options or strip any lines that do logging.

Your options:

1) disable logging in your production html using data-cycle-log=false. 2) disable logging in your production javascript by appending this after the cycle script: $.fn.cycle.log = $.noop; 3) wait for me to flip the default value of the log option (could be a while, sorry)

On Wed, Mar 4, 2015 at 8:51 PM, sunil notifications@github.com wrote:

First off: this plugin is fantastic. Thanks for developing it. It's my first choice of component for doing things like building wordpress slider plugins.

Using the minified messages are logged to console. I see output like this:

`[cycle2] --c2 init--

jquery.cycle2.min.js:6 [cycle2] speed: 400 (number) jquery.cycle2.min.js:6 [cycle2] activeClass: active (string) jquery.cycle2.min.js:6 [cycle2] random: true (boolean) jquery.cycle2.min.js:6 [cycle2] slides: div (string)`

I can see how this is useful, but does this kind of logging need to be in the minified version?

My usual expectation is that logging messages are stripped out of minified scripts, because the minified version are more likely to be used in production. At that point, logging is unneccesary.

I'm finding that if I use the minified version and I'm debugging something else on the page, logging from the minified cycle2 clutters the console, making it a little more difficult to find my own logging messages.

Thanks.

— Reply to this email directly or view it on GitHub https://github.com/malsup/cycle2/issues/669.

sunilw commented 9 years ago

Thanks for the quick response Mike.

For the moment I'm sure that setting data-cycle to false will be fine.

I'm not sure whether to close the issue or not. That would depend on what the design intent is for the minified version. So I guess I'll leave the decision whether to close the issue or not to you.

Again, thanks for cycle2. It's great.