How to write appropriate warning messages while writing Gradle plugin?

I am trying to write a Gradle plugin and I have a situation in which user specified bunch of files and when the file is not with specific extension then the warning has to be thrown, because these files can not be processed. So I am wondering if there is a convention how to construct appropriate warning message, so the message to be clear and not to disappear in the thousands line of project log.

I think something like:

WARNING!!! The file ${file.getName()} is with incompatible extention type ${extention}. The appropriate extension is ${EXTETNIO_TYPE}. The current file will not be taken during the build."

But while looking in the Gradle code. Their warning messages are just the message without WARNING or anything else. Please, give me your advises.

Answers


Warning messages are typically logged with log.warn(). However, if the files cannot be processed, it might be more appropriate to throw a GradleException. Warnings should be avoided whenever possible because they create noise, require the user to always check the command line output, and are easily overlooked.


Need Your Help

Android - how to make sure the header fits all the buttons?

android android-layout

I have a header that I am working on and I got the buttons to render in a single row, but one button does not fit on the screen and there is a space between the buttons.

Modeling VS Programming

computer-science modeling

This might be a general Computer Science question but the benefit of the question, what's the difference between Modelling and Programming? How are they approached both separately and combined?