el_oset_prefix¶
NAME¶
el_set_prefix - set custom prefix to add to every log
SYNOPSIS¶
#include <embedlog.h>
int el_set_prefix(const char *prefix)
int el_oset_prefix(struct el *el, const char *prefix);
DESCRIPTION¶
You can configure logger to add prefix to every message you print. prefix will be printed between log level info "i/" and you message. No spaces are added. If you set your prefix to simple PREFIX, printed message will be i/PREFIXmy log message, so you might want to add space there. If prefix is bigger than EL_PREFIX_LEN prefix will be truncated. To disable prefixing, simply set prefix to NULL.
EXAMPLES¶
el_set_prefix("my-prefix");
el_print(ELI, "some log");
/* log output */
/* i/my-prefix: some log */
el_set_prefix(NULL);
el_print(ELI, "some log");
/* log output */
/* i/some log */
RETURN VALUE¶
0 on succes, or -1 and set errno on failure.