By default, errors are printed to "stderr:" and execution is aborted, warnings are printed and debug conditions are printed. These messages can be muted and/or sent to a log file and execution can be aborted or continued. Verbose messages and operator messages can also be muted and/or sent to a log file. Control of DDS message printing and DDS program aborting are handled via the special "log:" dictionary. The available flags are listed below. Their values can either be "true" or "false".
Control Flags Default Function error_abort true abort program on error message warn_abort false abort program on warning message debug_abort false abort program on debug message error_print true print error messages to stderr warn_print true print warning messages to stderr debug_print true print debug messages to stderr verbose_print (note) print verbose messages to stderr operator_print true print operator messages to stderr error_log false print error messages to log: warn_log false print warning messages to log: debug_log false print debug messages to log: verbose_log false print verbose messages to log: operator_log false print operator messages to log: NOTE: verbose_print default is "true" iff "dds_debug" is present on the command line or par file.
To change any of these flags, write their new values to the "log:" dictionary. Suspending the "log:" dictionary causes dds to internally scan the dictionary and update the flags. Reseting the dictionary removes any accumulated log messages and resets all the control flags to their default values.
cdds_dict("log:", "print"); cdds_printf("error_abort", "false\n"); cdds_printf("error_print", "false\n"); cdds_printf("error_log", "true\n"); cdds_dict("log:", "suspend");
This can be useful in a "GUI" type program where the application can accumulate messages into the "log:" dictionary and then later read, display and clear the log of all these messages. For examples:
const char *defn, *value; ... cdds_dict("log:", "scan"); defn = cdds_newer("", ""); while(defn) { if (strstr(defn, "_msg")) { ier = cdds_scant("", &value); while (ier > 0) { printf(value); ier = cdds_scant("", &value); } } defn = cdds_newer("", ""); } cdds_dict("log:", "reset");