limb 0.2.0

2024-01-09

obuffer_level(3)
limb manual
obuffer_level(3)

NAME

obuffer_level, obuffer_setlevel - get/set the level of an output buffer

SYNOPSIS

#include <limb/obuffer.h>
u8 obuffer_level(obuffer *obuf)
void obuffer_setlevel(obuffer *obuf, u8 level)

DESCRIPTION

The obuffer_level() macro returns the current level of the output buffer pointed by obuf.

The obuffer_setlevel() macro will set the level of the output buffer pointed by obuf to level.

The following constants are defined as common levels, ordered from lower to higher :

  • OLVL_SILENT

Meant to be silent, i.e. disabled. (There should never be data sent with such a level.)

  • OLVL_QUIET

For the most minimum/required messages only.

  • OLVL_NORMAL

For regular output.

  • OLVL_VERBOSE

For additional/verbose output.

  • OLVL_DEBUG

Meant for debugging output only. See the dbg(3) macro to automatically prefix messages with file & function name as well as line number.

  • OLVL_MAXIMUM

If you need extra/verbose debugging messages.

As you must have guessed, the idea is simply to assign a level to different output, which can then be filtered at runtime by changing the level of the output buffer.

Thus, all functions that write data to an output buffer actually check first that the output buffer's level is at least that associated with the data. Only then will data be sent/written to the underlying buffer.

If the buffer has a lower level, then nothing is done.

Note that this check is actually performed for every output buffer in the chain, each buffer having its own level to determine whether or not to get written to.

For more about chains of output buffers, refer to obuffer_attach(3).

SEE ALSO

output.h(0)

limb 0.1.0
2023-07-24
obuffer_level(3)