There can be any number of Message Subscribers, whose job is to receive (and usually output) published messages. Trick automatically creates three Message Subscribers:
-`Trick::MessageCout` - outputs messages to the standard output stream
-`Trick::MessageFile` - outputs messages to a file named `send_hs` in the RUN directory
-`Trick::MessageTCDevice` - outputs messages to a socket at port 7200, used by the Simulation Control Panel for its Status Messages display
When you publish a message, it will be output by the three subscribers above.
A subscriber can be enabled / disabled at any time during simulation execution to output / ignore messages as desired.
The user may also add their own subscriber by creating a derived class from `Trick::MessageSubscriber`.
-`Trick::MessageThreadedCout` - outputs messages to the standard output stream asynchronously.
The `MessageThreadedCout` class is included with the simulation but not activated by default. When activated messages will be written to the standard output stream like `MessageCout`, but internally we use a separate thread to do the writing. This helps real-time performance.
To activate the `MessageThreadedCout` class, add these 2 lines to the input file.
int ::message_publish(int level, const char * format_msg, ...) ;
int ::send_hs(FILE * fp, const char * format_msg, ...) ;
```
The level number can be any integer from 0 to 99. Trick has a few predefined levels (`Trick::MessagePublisher::MESSAGE_TYPE`) that it uses for publishing messages.
If the message subscriber's color is enabled (see below), then a particular colored message will be displayed for each of these levels:
By default these are all subscribed. You can use subscribe/unsubscribe throughout a simulation to turn on/off messages at will.
```python
trick.message_unsubscribe(trick_message.mcout)
trick.message_unsubscribe(trick_message.mdevice)
trick.message_unsubscribe(trick_message.mfile)
```
To enable / disable Trick's default subscribers:
By default these are all enabled. If you disable `file` at startup, the `send_hs` file will not be created/opened. If you disable `device` at startup, its connection will not be established.
That means you cannot then later try to enable and subscribe to file/device.
```cpp
int message_cout_set_enabled(int yes_no) ;
int message_file_set_enabled(int yes_no) ;
int message_device_set_enabled(int yes_no) ;
```
To enable / disable showing colored messages in Trick's default subscribers:
By default color is enabled for `cout` and `device`. Color is achieved by adding ANSI escape codes around the message.
```cpp
int message_cout_set_color(int yes_no) ;
int message_file_set_color(int yes_no) ;
int message_device_set_color(int yes_no) ;
```
[Continue to Command Line Arguments](Command-Line-Arguments)