![]() |
![]()
| ![]() |
![]()
NAMEDtMsgLogMessage — logs a message SYNOPSIS#include &<Dt/MsgLog.h> void DtMsgLogMessage( const char* program_name, DtMsgLogType msg_type, const char* format, va_list args); DESCRIPTIONThe DtMsgLogMessage function logs the given arguments in one message. The format of the message is specified by format and thus is controlled by the application. The format of each logged entry is: *** &<Msgtype_string>( &<Msg_type>): &<Program_name>: PID &<Proc_id>: &<Date> The value of &<Msgtype_string> depends on the value of msg_type. Its value is:
&<Msgtype_string> is prefaced with the string *** and one space character. &<Msg_type> is replaced with the value of the msg_type argument (placed within parentheses). &<Program_name> is replaced with the value of the program_name. &<Proc_id> is the application's process id. &<Date> is the date and time the message is logged. &<The_message> is the formatted message including the arguments. &<Bytes_output> (enclosed in brackets) is replaced with the number of bytes output for the message and header information. (The number of bytes printed for the line containing &<Bytes_output> is not included.). A colon and a space (respectively) are printed after the closing parenthesis for &<Msg_type>, &<Program_name>, and &<Proc_id>. One newline is output after the date and one newline is output after the message. After the message, a line beginning with the string *** is output, followed by a space character, a [ character, the number of bytes printed, a ] character, and,finally, two newlines (one blank line separates messages). The message type string and date specification are localized and thus are retrieved from the current locale's message catalog. It is the application's responsibility to localize the message to be logged. An example log entry is: *** WARNING(3): fontview: PID 12312: Thu Jun 13 16:51:51 1995 The specified font 'fixed' could not be loaded. *** [109] To log a multi-line message, use a single call to DtMsgLogMessage. DtMsgLogMessage attempts to open the following files in the indicated sequence (by calling the fopen function with the a+ option). It uses the first file that is successfully opened.
DtMsgLogMessage calls DtMsgLogOpenFile to determine where to log the message. If DtMsgLogOpenFile returns NULL, DtMsgLogMessage will output the message to stderr. ARGUMENTS
STRUCTURESThe msg_type argument is specified as a DtMsgLogType enumeration data type, with the following members:
RETURN VALUENone. ENVIRONMENT VARIABLESThe values of the following environment variables determine which file is opened by DtMsgLogMessage: HOME, LOGNAME, USER, and DTUSERSESSION. See "Description" in this man page for more information. Because DtMsgLogMessage calls the catopen function, it is indirectly influenced by the environment variables that affect catopen, such as LANG, and NLSPATH. See catopen(3) for more information. RESOURCESNone. ACTIONS/MESSAGESThe default mechanism to view the message log is to invoke the Watch Errors action which is located in the Application Manager's Desktop_Tools folder. ERRORS/WARNINGSNone. EXAMPLESThe following code fragment illustrates how to log a localized warning message: #include &<nl_types.h> char *s1, *s2; /* temp strings - catgets may return FILESSee DtMsgLogOpenFile(3). SEE ALSODtMsgLogOpenFile(3), DtMsgLogSetHandler(3)
|