LogError method is for displaying an error message to the
user. The error message will be displayed in the "Message Log" in the red color.
The report generator has a built-in mechanism to prevent the same error message
from being displayed more than once, so you can use the
method without worrying about the same error message being displayed thousand of
times if a template is used repetitively. The
automatically appends the new line character to the message log, so you do not
need to append the
In the future, there will be other methods such as
LogComment methods. Those method will behave similar to
LogError but will display the text in a different color.
LogError is usually followed by the method
Report.LogError "Error loading essential Component X"
LogError is a method of the
object rather than being a method of the
object. After all, it would make more sense to use
ReportGenerator.LogError rather than
rationale of this design decision is for future growth, as a single
ReportGenerator object may have many
Report objects running simultaneously. By having the
LogError part of the report stream, it will make
troubleshooting much easier by knowing which script logged the error.