#include <cat/cat.h>
void caterr_setprefix(const char *prefix);
This function sets the message prefix for all error and debug messages. The
prefix is a string that can contain embedded controls, as follows:
- %l
-
the entire label, "module.function_name".
- %f
-
the function name only, "function_name".
- %n
-
the program name, as set by caterr_setprogname().
- %p
-
the process id.
- %s
-
the session id, or
"*"
if no session is available.
- %e
-
the error level, or nothing if the major code is CAT_DEBUG.
- %c
-
the error code (symbolic), or nothing if the minor code is CAT_OK.
- %C
-
the error code (a description string), or nothing if the minor code is
CAT_OK.
- %t
-
the time since previous output in the same context, in seconds and 100ths
of seconds.
- %T
-
the time stamp (month, day, hours:min:sec)
- %%
-
a percentage
"%"
character.
- %[c
-
produces `` [%c]'' if
%c
produces a result, where c is any of the other format characters described in this section.
- %(c
-
produces `` (%c)'' if
%c
produces a result.
The following Escape characters are also recognized:
- \n
-
NewLine
- \t
-
horizontal TAB
- \\
-
backslash
"\"
.
- \%
-
percentage
"%"
character.
The default output prefix is "%p %n[%s] %f: "
. The following example produces prefixes with a differential time stamp,
session id, and function name, with the major code in parentheses for
messages that are not debug traces. For example:
caterr_setprefix("%t %s %f%[e: ");
cat, caterr