|
|
|
# Output user messages
|
|
|
|
|
|
|
|
In this section you will find how to properly output information, warning or error messages for the end user.
|
|
|
|
|
|
|
|
## Diagnostics Class
|
|
|
|
You can use a special class designed to output warning or fatal error messages to the user.
|
|
|
|
The code is in the following package and class:
|
|
|
|
|
|
|
|
```java
|
|
|
|
package ltsa.lts;
|
|
|
|
|
|
|
|
public class Diagnostics {...}
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
In order to use Diagnostics, you must first initialize the default output option.
|
|
|
|
|
|
|
|
In case you are using the UI, you need to initialize it with the LTSOuput used by the main window.
|
|
|
|
|
|
|
|
```java
|
|
|
|
Diagnostics.init(out);
|
|
|
|
```
|
|
|
|
|
|
|
|
From _MTSA> Options> Treat Warnings as errors_ you can force warnings to raise an exception.
|
|
|
|
|
|
|
|
|
|
|
|
### Warning and Fatal
|
|
|
|
Fatal errors can be used just with a string message or marking the symbol or position of the error.
|
|
|
|
|
|
|
|
Warning messages can be used just with the string message.
|
|
|
|
|
|
|
|
|
|
|
|
## log
|
|
|
|
In some places it is also use the java logger. It is not recommended for end user, only for techinical log output.
|
|
|
|
|
|
|
|
```java
|
|
|
|
import org.apache.log4j.Logger;
|
|
|
|
|
|
|
|
private Logger logger = Logger.getLogger(this.getClass().getName());
|
|
|
|
logger.error("Scheduler factory not found");
|
|
|
|
```
|
|
|
|
|
|
|
|
## System.out.println()
|
|
|
|
This practice is discourage. Use only for testing and debugging purposes.
|
|
|
|
|
|
|
|
--- |