No warning when the log file config isn't set properly
Closed this issue · 4 comments
When upgrading LintRoller from an older version (not sure which one) the log file suddenly stopped being generated, even though LintRoller said to go check my log file.
The problem was that our old LintRoller config had the log file set to a string, whereas the new LintRoller requires it to be an object. It took me a while to figure out why my log file wasn't there.
If LintRoller warned when it had an invalid file path to log to, it would be really helpful.
I wasn't sure if you would prefer a function to verify the validity of the config and spit out helpful information regarding bad settings, or if it would be better to just worry about the log file, so I didn't try to implement it myself.
So in v2.3 I changed the way in which the "logFile" config works (now using object, previously using string). I did make a note in the CHANGELOG about this... though I'll admit it may not have been as clear as it could have been. In v2.3.2 you can now set "logFile" to null in order to disable logging the output to a file.
We can add this "feature" to validate the log file... but if we go down this road, I worry if we set a precedent for validating all features that change over time.
On the other hand, perhaps I should simply accept a string and default to "text" output.
For what it's worth, I should validate that the logFile path exists (or at least handle the exception).
Thoughts?
If you don't want to go down the road of validating configs, I think just warning when it can't or doesn't write to the log file is sufficient. To me, that falls more under error handling than validation.
It might be helpful if LintRoller output its version when you run it so the user is more likely to notice that a version change took place and that might be why their previous configs aren't working as expected. Our installed version of LintRoller was different than the one I downloaded from GitHub, but I had no clue until things started going wrong.
v2.3.3 pushed to NPM and GitHub (master). This should fix the issues you mention!
Fantastic! If I see anything else I'll let you know.