psliwa / image-optimizer

Image optimization / compression library. This library is able to optimize png, jpg and gif files in very easy and handy way. It uses optipng, pngquant, pngcrush, pngout, gifsicle, jpegoptim and jpegtran tools.
MIT License
906 stars 141 forks source link

Change the log level from "notice" to "error" ? #70

Closed gnutix closed 4 years ago

gnutix commented 5 years ago

Hello there! I recently started using your library, and at first I was quite surprise to have my images not being optimized as I expected and nothing showed up in my command (I passes a \Symfony\Component\Console\Logger\ConsoleLogger instance to \ImageOptimizer\OptimizerFactory as a second argument).

Then I digged into the code and realized that you transform every Exception being thrown into a Logger::notice(). Which only shows up if you have at least the --verbose/-v flag. Then I got some output stating that one of my option was wrong and I could fix it.

However, as these are errors (Exceptions), I think the intuitive/expected behavior would be to display them even without verbose, which is the case when using Logger::error().

What do you think ? Any specific reason why you used notice instead from the get go ?

psliwa commented 4 years ago

Hi. Thanks for the issue.

Yes, suggestion looks good, error may be more appropriate log level for this situation. Fix will be available from 2.0.1 version.