CAMAC Front-End Documentation : Software Description : Logging Messages : Simplifying logMsg() with macros
Previous: Logging Messages
Next: Debug Messages

2.2.1. Simplifying logMsg() with macros

Although the logging facility has many strengths, it does have a drawback; it requires six arguments after the format string -- even if the arguments aren't used. This makes the function slightly annoying to use. To make it appear more printf-like, seven macros have been defined. These macros take the form logMsgn(fmt, arg1, arg2, ..., argn) where n indicates how many of the six trailing arguments there are. If only the format string is to be displayed, logMsg0(fmt) can be used.

The macros append a newline to the format string, so it not necessary to specify one.

2.2.1.1. Example

If a task with an ID of 0x123456 and a name 'tMyTask' makes the call:

logMsg1("The system call returned %d", errno);

the message log will get the following entry:

0x123456 (tMyTask): The system call returned 0


CAMAC Front-End Documentation : Software Description : Logging Messages : Simplifying logMsg() with macros
Previous: Logging Messages
Next: Debug Messages

Security, Privacy, Legal