Convenience macros to make use of caps_message_print()
More...
Always make use if these macros and never use caps_message_print() directly.
These macros will - in some cases - automatically add the scope, function name and line number to the message.
- Note
- Starting with verbosity level LIBCAPS_LOUD (refer caps_verbosity), the scope, the function name and the line number leads every message. If the verbosity level is below LIBCAPS_LOUD, this additional info is suppressed and only the message itself is printed.
An exception is a panic message, where the additional info is always printed.
This should prevent the CAPS universe from flooding the logs. Refer caps_verbosity_level_set() and caps_helper_verbosity_setup() how to change the verbosity level at run-time.
Or take a look into the INI files and their [debug] section to define the verbosity level.
- Attention
- Using these macros complicate consecutive prints into one line. E.g.
caps_print_info("This is only a"); caps_print_info(" part of a line\n");
may result in an annoying output if the verbosity level is at LIBCAPS_LOUD or above.
- Note
- The caps_print_debug() is missing in this global list. This macro must be defined individually in each CAPS component. To keep it in sync, you may use caps_print_debug_template() for your own macro. Follow the example in the caps_print_debug_template() description.
- Attention
- Using these macros requires the definition of the macro PACKAGE. This is usually defined in the package's local config.h. The value of PACKAGE is used to define the scope of the message.
◆ caps_print_panic
#define caps_print_panic |
( |
|
fmt, |
|
|
|
... |
|
) |
| |
Output a panic message. After this message, the program should terminate
#define caps_print_panic(fmt,...)
Definition: libcapsbase.h:244
- Note
- It is a wrapper around caps_message_print() and uses LIBCAPS_PANIC for the verbosity
level
◆ caps_print_error
#define caps_print_error |
( |
|
fmt, |
|
|
|
... |
|
) |
| |
Output an error message. After this message, the program may continue
#define caps_print_error(fmt,...)
Definition: libcapsbase.h:252
- Note
- It is a wrapper around caps_message_print() and uses LIBCAPS_ERROR for the verbosity
level
◆ caps_print_warn
#define caps_print_warn |
( |
|
fmt, |
|
|
|
... |
|
) |
| |
Output a warning message. After this message, the program continues at best it can
#define caps_print_warn(fmt,...)
Definition: libcapsbase.h:260
- Note
- It is a wrapper around caps_message_print() and uses LIBCAPS_WARN for the verbosity
level
◆ caps_print_info
#define caps_print_info |
( |
|
fmt, |
|
|
|
... |
|
) |
| |
Output an informational message. Its just for user's information. Do not use this excessive!
#define caps_print_info(fmt,...)
Definition: libcapsbase.h:268
- Note
- It is a wrapper around caps_message_print() and uses LIBCAPS_INFO for the verbosity
level
◆ caps_print_loud
#define caps_print_loud |
( |
|
fmt, |
|
|
|
... |
|
) |
| |
Output a major trace message. Used to track major program states
#define caps_print_loud(fmt,...)
Definition: libcapsbase.h:276
- Note
- It is a wrapper around caps_message_print() and uses LIBCAPS_LOUD for the verbosity
level
◆ caps_print_noisy
#define caps_print_noisy |
( |
|
fmt, |
|
|
|
... |
|
) |
| |
Output a minor trace message. Used to track program states in more detail
#define caps_print_noisy(fmt,...)
Definition: libcapsbase.h:284
- Note
- It is a wrapper around caps_message_print() and uses LIBCAPS_NOISY for the verbosity
level
◆ caps_print_debug_template
#define caps_print_debug_template |
( |
|
fmt, |
|
|
|
... |
|
) |
| |
The output of debug messages is up to the packages. To simplify things, here is a template. Use it in your own package like this:
#ifdef DEBUG
# define caps_print_debug(fmt, ...) caps_print_debug_template(fmt, ##__VA_ARGS__)
#else
# define caps_print_debug(fmt, ...)
#endif
- Precondition
- You should not use the caps_print_debug_template() macro directly. Always wrap it into a caps_print_debug() call, which gets removed entirely if debugging is disabled when compiling by using this code in one of your central include files.
- Note
- It is a wrapper around caps_message_print() and uses LIBCAPS_DEBUG for the verbosity
level