mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
Checked all tools for the presence of log_parse()
This commit is contained in:
parent
f976ce5418
commit
b2fcfdca9d
5 changed files with 32 additions and 1 deletions
|
@ -33,6 +33,9 @@ struct log;
|
|||
extern "C"{
|
||||
#endif
|
||||
|
||||
/** Wrapper for log_parse, to check if config file exists **/
|
||||
int log_parse_wrapper(struct log *l, json_t *cfg);
|
||||
|
||||
/** Parse logging configuration. */
|
||||
int log_parse(struct log *l, json_t *cfg);
|
||||
|
||||
|
@ -43,4 +46,4 @@ void jerror(json_error_t *err, const char *fmt, ...)
|
|||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -31,6 +31,24 @@
|
|||
#include <villas/log_config.h>
|
||||
#include <villas/utils.h>
|
||||
|
||||
int log_parse_wrapper(struct log *l, json_t *cfg)
|
||||
{
|
||||
int ret;
|
||||
json_t *json_logging = NULL;
|
||||
json_error_t err;
|
||||
|
||||
ret = json_unpack_ex(cfg, &err, 0, "{s?: o}",
|
||||
"logging", &json_logging
|
||||
);
|
||||
if (ret)
|
||||
jerror(&err, "Failed to parse global configuration");
|
||||
|
||||
if(json_logging)
|
||||
log_parse(l, json_logging);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int log_parse(struct log *l, json_t *cfg)
|
||||
{
|
||||
const char *facilities = NULL;
|
||||
|
|
|
@ -165,6 +165,10 @@ check: if (optarg == endptr)
|
|||
if (ret)
|
||||
error("Failed to initialize log");
|
||||
|
||||
ret = log_parse_wrapper(&l, cfg_cli);
|
||||
if (ret)
|
||||
error("Failed to parse log");
|
||||
|
||||
ret = log_open(&l);
|
||||
if (ret)
|
||||
error("Failed to start log");
|
||||
|
|
|
@ -117,6 +117,10 @@ int main(int argc, char *argv[])
|
|||
if (ret)
|
||||
error("Failed to initialize log");
|
||||
|
||||
ret = log_parse_wrapper(&l, n.cfg);
|
||||
if (ret)
|
||||
error("Failed to parse log");
|
||||
|
||||
ret = log_open(&l);
|
||||
if (ret)
|
||||
error("Failed to start log");
|
||||
|
|
|
@ -127,6 +127,8 @@ check: if (optarg == endptr)
|
|||
super_node_init(&sn);
|
||||
super_node_parse_uri(&sn, configfile);
|
||||
|
||||
log_open(&sn.log);
|
||||
|
||||
signals_init(quit);
|
||||
rt_init(sn.priority, sn.affinity);
|
||||
memory_init(sn.hugepages);
|
||||
|
|
Loading…
Add table
Reference in a new issue