CAPS Universe documentation  1.0.4
All you need to know to be successful
Enumerations | Functions

Base API used all over the CAPS universe. More...

Enumerations

enum  caps_verbosity {
  LIBCAPS_PANIC = 1 ,
  LIBCAPS_ERROR ,
  LIBCAPS_WARN ,
  LIBCAPS_INFO ,
  LIBCAPS_LOUD ,
  LIBCAPS_NOISY ,
  LIBCAPS_DEBUG
}
 Define the noise level of messages. All messages above a current noise level will be discarded. More...
 

Functions

void caps_libbase_init (void)
 
void caps_verbosity_level_set (enum caps_verbosity level, bool overwrite)
 
void caps_message_stream_set (FILE *stream)
 
void caps_message_print (enum caps_verbosity level, const char *scope, const char *fn, int ln, const char *format,...) 6)
 

Detailed Description

Enumeration Type Documentation

◆ caps_verbosity

Enumerator
LIBCAPS_PANIC 

Really bad news, corresponds to caps_print_panic()

LIBCAPS_ERROR 

Any kind of error, corresponds to caps_print_error()

LIBCAPS_WARN 

Any kind of warnings, corresponds to caps_print_warn()

LIBCAPS_INFO 

Any kind of information, corresponds to caps_print_info()

LIBCAPS_LOUD 

Any kind of traceability, corresponds to caps_print_loud()

LIBCAPS_NOISY 

More traceability, corresponds to caps_print_noisy()

LIBCAPS_DEBUG 

Debugging information, only with configure's '–enable-debug', corresponds to caps_print_debug()

Function Documentation

◆ caps_libbase_init()

void caps_libbase_init ( void  )

Initialize the library prior use

Note
This function can be called multiple times.

◆ caps_verbosity_level_set()

void caps_verbosity_level_set ( enum caps_verbosity  level,
bool  overwrite 
)

Define the verbosity level of messages the CAPS libraries should emit

Parameters
[in]levelUp to this verbosity level the libraries will emit messages
[in]overwritetrue to set the level value, false to restrict to higher level
Precondition
LIBCAPS_DEBUG only works if the source was configured and compiled with '–enable-debug'. If not, a call with LIBCAPS_DEBUG gets ignored!

Messages with a higher level will be dropped (refer caps_message_print() for details).

Note
If overwrite is false, a new verbosity level is set only if the currently active level is 'lower'. E.g. if the current active level is LIBCAPS_WARN and you call level with LIBCAPS_INFO it will be set. But if you call with level LIBCAPS_ERROR instead, it won't be set.
This function uses an integer/enum to set the verbosity. Refer caps_helper_verbosity_setup() for the same feature, but based on a string keyword instead.

◆ caps_message_stream_set()

void caps_message_stream_set ( FILE *  stream)

Setup the stream the CAPS universe should emit messages to (via caps_message_print)

Parameters
[in]streamThe stream to use for future messages (can be NULL)

Until called with a different stream, the CAPS universe uses 'stderr' as the default

Note
If stream is invalid, the current setting is kept
The stream can be NULL. In this case the library falls back to its default (e.g. 'stderr')

◆ caps_message_print()

void caps_message_print ( enum caps_verbosity  level,
const char *  scope,
const char *  fn,
int  ln,
const char *  format,
  ... 
)

Print function used in the whole CAPS universe to emit messages

Parameters
[in]levelVerbosity level of this message
[in]scopeThe message's scope, like it's package name
[in]fnName of the function, this output is from
[in]lnLine number this call is from
[in]formatThe format string. Refer the printf() manual for further details
Note
Do not use this function directly. You should always use the convenience macros in Message macros instead.