el_flush(3)

bofc manual pages

el_flush(3)



 

NAME

el_flushel_oflush - flush logs from all buffers to underlying devices.  

SYNOPSIS

#include <embedlog.h>

int el_flush(void)
int el_oflush(struct el *el)  

DESCRIPTION

embedlog (and underlying drivers, operating systems, libraries etc) to improve performance, may buffer message before commiting changes to actual device. And it's ok, there is really no need to waste resources every time you want to log 50 bytes of debug print on commiting message physically to the drive - or send via network. It's much more common to buffer messages in RAM until certain ammount of bytes are ready to send - and then send a bunch of data in one quick burst. But that behaviour is not always desired, like in situation in which we know we won't be printing logs for long time. For such situation explicit flush may in order.

el_flush(3) flushes logs from all buffers to underlying device. For example, when logs are printed to file, logs are written through buffered stdio functions, which may result in some logs never being actually put into block device in case of abnormal application crash - that of course depends on settings like EL_FSYNC_EVERY. This function will do everything what is in its power to make sure logs landed on underlying device. This applies to files, but also to logs with network output.

el_oflush(3) works just the same, but accepts custom el object as argument.  

RETURN VALUE

Functions return 0 upon successful flush or -1 on errors. When -1 was returned there is no guarantee that data has landed on underlying device.  

ERRORS

el_flush(3) and el_oflush(3) may return errors from functions like: fflush(), fileno(), fsync(), fseek(), ftell(), fopen() and/or fclose().

el_oflush(3) may additionally return:

EINVAL
Passed el object is not valid
 

SEE ALSO

el_overview(7), el_cleanup(3), el_destroy(3), el_init(3), el_new(3), el_ocleanup(3), el_oinit(3), el_ooption(3), el_operror(3), el_opmemory(3), el_opmemory_table(3), el_oprint(3), el_option(3), el_oputs(3), el_ovprint(3), el_perror(3), el_pmemory(3), el_pmemory_table(3), el_print(3), el_puts(3), el_vprint(3).

bofc.pl

25 January 2021 (v0.6.0)

el_flush(3)