mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
show correct filename in cerror() messages
This commit is contained in:
parent
1ed9663532
commit
46ff3462cc
1 changed files with 8 additions and 5 deletions
13
lib/log.c
13
lib/log.c
|
@ -308,18 +308,21 @@ void cerror(config_setting_t *cfg, const char *fmt, ...)
|
|||
{
|
||||
va_list ap;
|
||||
char *buf = NULL;
|
||||
const char *file;
|
||||
int line;
|
||||
|
||||
assert(log != NULL);
|
||||
|
||||
va_start(ap, fmt);
|
||||
vstrcatf(&buf, fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
line = config_setting_source_line(cfg);
|
||||
file = config_setting_source_file(cfg);
|
||||
if (!file)
|
||||
file = config_setting_get_hook(config_root_setting(cfg->config));
|
||||
|
||||
log_print(log, LOG_LVL_ERROR, "%s in %s:%u", buf,
|
||||
config_setting_source_file(cfg)
|
||||
? config_setting_source_file(cfg)
|
||||
: "(stdio)",
|
||||
config_setting_source_line(cfg));
|
||||
log_print(log, LOG_LVL_ERROR, "%s in %s:%u", buf, file, line);
|
||||
|
||||
free(buf);
|
||||
die();
|
||||
|
|
Loading…
Add table
Reference in a new issue