MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 1 | SYNOPSIS |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 2 | #include <debug_message.h> |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 3 | |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 4 | void debug_message(string text) |
| 5 | void debug_message(string text, int flags) |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 6 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 7 | DESCRIPTION |
| 8 | Prints the given text to stdout, stderr, the <host>.debug.log file, |
| 9 | or any combination of these. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 10 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 11 | The parameter <flags> is a combination of bitflags determining the |
| 12 | target and the mode of writing. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 13 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 14 | The target flags are: DMSG_STDOUT, DMSG_STDERR and DMSG_LOGFILE. |
| 15 | If the flag DMSG_STAMP is given, the message is prepended with the |
| 16 | current date and time in the format 'YYYY.MM.DD HH:MM:SS '. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 17 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 18 | If <flags> is given as 0, left out, or contains no target |
| 19 | definition, debug_message() will print to stdout and to the logfile. |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 20 | |
Zesstra | d59c389 | 2019-11-28 20:53:39 +0100 | [diff] [blame] | 21 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 22 | EXAMPLES |
| 23 | debug_message("This goes to stdout and the logfile.\n"); |
| 24 | debug_message("This goes to stderr.\n", DMSG_STDERR); |
| 25 | debug_message("This goes to stdout and stderr.\n" |
| 26 | , DMSG_STDOUT | DMSG_STDERR); |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 27 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 28 | debug_message("This goes to stdout and the logfile, with timestamp.\n" |
| 29 | , DMSG_STAMP); |
| 30 | debug_message("This goes to stdout and has the timestamp in front.\n" |
| 31 | , DMSG_STDOUT | DMSG_STAMP); |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 32 | |
Zesstra | 715ec20 | 2025-07-09 22:18:31 +0200 | [diff] [blame] | 33 | HISTORY |
| 34 | Introduced in 3.2.1@34. |
| 35 | LDMud 3.2.9 introduced the <flags> parameter. |
| 36 | |
| 37 | SEE ALSO |
MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame] | 38 | last_instructions(E) |